請教老師一個(gè)表單js檢測無效的問題
老師我想請教一個(gè)問題
我用jm做了一個(gè)手機(jī)頁面
但是從首頁點(diǎn)擊菜單跳轉(zhuǎn)到某頁面之后
發(fā)現(xiàn)這個(gè)頁面里面的js無效
然后表單隨便就能提交到數(shù)據(jù)庫了?
本來設(shè)置了JS進(jìn)行空表單的判斷的檢測的,但是能直接就提交!
如果把這個(gè)提交表單的頁面進(jìn)行了刷新的話,則這個(gè)js就有效
會(huì)彈窗檢測空表單
這個(gè)是為何呢???
<!-- #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>大泉州家教網(wǎng)觸摸版_請家教</title>
<META name="description" content="大泉州家教網(wǎng)專業(yè)為家長和學(xué)員提供一對一上門家教輔導(dǎo)服務(wù),免費(fèi)試教,不滿意包換,滿意為止!打造大泉州地區(qū)第一家教服務(wù)品牌!" />
<META name="keywords" content="泉州家教,泉州家教網(wǎng),泉州家教兼職,泉州家教招聘,晉江家教,石獅家教" />
<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("請?zhí)顚懩姆Q呼");
? ? document.getElementById("RealName").focus();
? ? return false;
? ? }
if(document.getElementById("xysf").value == ""){
? ? alert("請選擇學(xué)員的年級(jí)");
? ? document.getElementById("xysf").focus();
? ? return false;
? ? }
if(document.getElementById("Position_b1").value == ""){
? ? alert("請至少選擇一門輔導(dǎo)科目");
? ? document.getElementById("Position_b1").focus();
? ? return false;
? ? }
if(document.getElementById("Qualification").value == ""){
? ? alert("請選擇適合您的輔導(dǎo)方式");
? ? 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("請?zhí)顚懩穆?lián)系手機(jī)號(hào)碼");
? ? document.getElementById("Tel").focus();
? ? return false;
? ? }
if(document.getElementById("County").value == ""){
? ? alert("請選擇您需要家教的地點(diǎn)");
? ? document.getElementById("County").focus();
? ? return false;
? ? }
if(document.getElementById("HomeAddr").value == ""){
? ? alert("家教詳細(xì)地址不能為空");
? ? document.getElementById("HomeAddr").focus();
? ? return false;
? ? }
if(document.getElementById("password").value == ""){
? ? alert("請?jiān)O(shè)置一個(gè)會(huì)員密碼");
? ? 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>請?zhí)顚懻埣医绦枨?lt;/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">聯(lián)系人姓名:</label>
<input type="text" id="RealName" name="RealName" placeholder="*請輸入您的姓名或稱呼,例如:“楊先生”" maxlength="30" class="validate[required,custom[chinese],minSize[2]" data-errormessage-value-missing="聯(lián)系人不能為空" ?
? ? data-errormessage-custom-error="請輸入正確的中文名稱" data-prompt-position="topLeft">
<label for="xysf" class="select">學(xué)員身份:</label>
<select name="xysf" id="xysf" class="validate[groupRequired[xysf]]" data-errormessage-value-missing="請選擇學(xué)員目前身份" data-prompt-position="topLeft" data-role="none">
<label for="password">設(shè)置管理密碼:</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個(gè)字符,否則無法提交"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>