<script language="JavaScript">
function Check()
{
if(document.form.content.value=="")
{
window.alert("请输入您要查询的内容!");
document.form.content.focus();
}
else
{
form.submit();
}
}
</script>
<form method="post" action="servlet/searchStaffServlet" name="form">
<input name="submit" type="button" id="submit" onclick="Check()" value="查询">
点击查询为何不跳转到servlet/searchStaffServlet呢?实在搞不懂啊!
function check(){
var form = document.forms[0];
if(form.stm_college.value==""){alert("请填写完整");return false;}
if(form.stm_department.value==""){alert("请填写完整");return false;}
if(form.stm_professional.value==""){alert("请填写完整");return false;}
else
{
form.submit();
}}
</script>
form这么取得试试!
这个对话框还能弹出的来,但是form.submit();就没执行
不知为何
难道你认为 if 和 else 能全部执行!!
function Check()
{
if(document.form.content.value=="")
{
window.alert("请输入您要查询的内容!");
document.form.content.focus();
}
else
{
不要submit;//(要能写出这样的语句也行^_^)
}
}
<input name="submit" type="button" id="submit" onclick="Check()" value="查询"/>