请教老师一个表单js检测无效的问题
老师我想请教一个问题
我用jm做了一个手机页面
但是从首页点击菜单跳转到某页面之后
发现这个页面里面的js无效
然后表单随便就能提交到数据库了
本来设置了JS进行空表单的判断的检测的,但是能直接就提交!
如果把这个提交表单的页面进行了刷新的话,则这个js就有效
会弹窗检测空表单
这个是为何呢???
<!-- #include file="../conn.asp" -->
<!--#include file="../Comm/Site_Class.asp" -->
<!--#include file="../Comm/MobileSMS.asp" -->
<!--#include file="../Comm/function.asp" -->
<%
Dim Rs,ThisYear,Tel
Set Qsite = New Site_Class
Qsite.SiteConfig()
Qsite.GotoErrPage()
'If Session("PerId") <> "" Or Session("ComId") <> "" Then
'Response.Redirect("Login_Check.asp")
'Response.End()
'End If
If Qsite.PerRegClose = "1" Then
Response.Redirect("errpage.asp?str="& Qsite.PerRegCloseNote)
Response.End()
End If
ThisYear = Year(Date())
%>
<!DOCTYPE html>
<html>
<head>
<title>大泉州家教网触摸版_请家教</title>
<META name="description" content="大泉州家教网专业为家长和学员提供一对一上门家教辅导服务,免费试教,不满意包换,满意为止!打造大泉州地区第一家教服务品牌!" />
<META name="keywords" content="泉州家教,泉州家教网,泉州家教兼职,泉州家教招聘,晋江家教,石狮家教" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="x-rim-auto-match" content="none">
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="css/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" href="css/validationEngine.jquery.css">
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/jquery.mobile-1.4.2.min.js"></script>
<script charset="UTF-8" src="js/jquery.validationEngine-zh_CN.js"></script>
<script charset="UTF-8" src="js/jquery.validationEngine.min.js"></script>
<script>
function checkform(){
if(document.getElementById("RealName").value == ""){
alert("请填写您的称呼");
document.getElementById("RealName").focus();
return false;
}
if(document.getElementById("xysf").value == ""){
alert("请选择学员的年级");
document.getElementById("xysf").focus();
return false;
}
if(document.getElementById("Position_b1").value == ""){
alert("请至少选择一门辅导科目");
document.getElementById("Position_b1").focus();
return false;
}
if(document.getElementById("Qualification").value == ""){
alert("请选择适合您的辅导方式");
document.getElementById("Qualification").focus();
return false;
}
if(document.getElementById("Salary").value == ""){
alert("请选您给老师的薪资待遇");
document.getElementById("Salary").focus();
return false;
}
if(document.getElementById("Teasf").value == ""){
alert("请选择您所需要的老师类型");
document.getElementById("Teasf").focus();
return false;
}
if(document.getElementById("Tel").value == ""){
alert("请填写您的联系手机号码");
document.getElementById("Tel").focus();
return false;
}
if(document.getElementById("County").value == ""){
alert("请选择您需要家教的地点");
document.getElementById("County").focus();
return false;
}
if(document.getElementById("HomeAddr").value == ""){
alert("家教详细地址不能为空");
document.getElementById("HomeAddr").focus();
return false;
}
if(document.getElementById("password").value == ""){
alert("请设置一个会员密码");
document.getElementById("password").focus();
return false;
}
}
</script>
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
%>
</head>
<div data-role="page">
<div data-role="header"><h1>请填写请家教需求</h1>
<a href="javascript:history.go(-1)" data-role="button" data-rel="back">返回</a>
</div><!-- /header -->
<form method="post" id="form" action="m_student_save.asp" data-ajax="false" onsubmit="return checkform()">
<label for="RealName">联系人姓名:</label>
<input type="text" id="RealName" name="RealName" placeholder="*请输入您的姓名或称呼,例如:“杨先生”" maxlength="30" class="validate[required,custom[chinese],minSize[2]" data-errormessage-value-missing="联系人不能为空"
data-errormessage-custom-error="请输入正确的中文名称" data-prompt-position="topLeft">
<label for="xysf" class="select">学员身份:</label>
<select name="xysf" id="xysf" class="validate[groupRequired[xysf]]" data-errormessage-value-missing="请选择学员目前身份" data-prompt-position="topLeft" data-role="none">
<label for="password">设置管理密码:</label>
<input type="password" name="PassWord" id="password" value="" autocomplete="off" class="validate[required],minSize[5]" data-errormessage-value-missing="密码不能为空,请重新填写" data-errormessage-custom-error="*密码必须至少输入5个字符,否则无法提交"data-prompt-position="topLeft:30%px;">
<p style="text-align:center;">
<input type="submit" data-inline="true" data-role="button" data-icon="check" value="提交">
<a href="javascript:history.go(-1)" data-role="button" data-icon="back" data-inline="true">返回</a>
<p>
</form>