我有一个带框架的页面。上部框架是一个标题,其中包含用于对数据库执行搜索的控件,下部用于显示搜索结果。 用户可以单击搜索模式按钮,在提示输入搜索条件的位置提示,然后在较低的框架中查看结果。获取已取消的javascript提示不执行任何操作
除了当用户取消提示时,一切都很好。该页面重新加载并将上部(标题)html放入较低的框架中。
的搜索模式中的一种代码:
function searchBySid(){
var sidNum = prompt("Enter the SID to search for:","");
if(sidNum!=null){
document.getElementById("formType").value = "SearchBySid";
document.getElementById("sid").value = sidNum;
var form = document.getElementById("headerForm");
form.action="OffenderRegistration";
form.method="GET";
form.submit();
}
}
我如何让页面做什么,如果提示被取消?
编辑:
它通过的onclick一个按钮叫:
<table align="center">
<tr>
<td><button id="btnSearchSid" name="btnSearchSid" class="menuButton" onclick="searchBySid()">Search by SID</button></td>
<td><button id="btnSearchDps" name="btnSearchDps" class="menuButton" onclick="searchByDps()">Search by DPS</button></td>
<td><button id="btnSearchName" name="btnSearchName" class="menuButton" onclick="searchByName()">Search by Name</button></td>
<td><button id="btnAdd" name="btnAdd" class="menuButton" onclick="getAddForm()">Add</button></td>
<td><button id="btnReports" name="btnReports" class="menuButton">Reports</button></td>
<td style="color: white;"> Today's Date: <label style="color: white;" id="lblDate"></label></td>
</tr>
</table>
你是怎么称呼这个功能的!您可能需要取消该操作! – epascarello
你打电话给'searchBySid'? – Halcyon