0
다음은 Firefox 및 Chrome에서 제대로 작동하고 유효성을 검사하는 간단한 HTML 양식이지만 IE9에서는 유효하지 않습니다. IE에서 입력을 입력하지 않고 제출 단추를 반복해서 누르면 확인 메시지가 화면에 반복해서 인쇄됩니다. I 모드 호환성 (을)하기 위해 IE를 전환 할 때IE9에서 HTML 양식의 유효성을 검사하지 않습니다.
, 유효성 검사 메시지가 인쇄와 아무런 반응이 없습니다 :(
다음은 HTML 코드입니다 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
<script type="text/javascript">
</script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("#contactform").validate({
rules: {
firstname : "required",
surname : "required",
emessage : "required",
pcode1 : "required",
phone : "required",
cname : "required",
email: { // compound rule
required: true,
email: true
}
},
messages: {
firstname : " *Required",
surname : " *Required",
email : " *Required",
emessage : " *Required",
pcode1 : " *Required",
phone : " *Required",
cname : " *Required",
}
});
});
</script>
<title>Example</title>
</head>
<body>
<p>
<form id="contactform" method="post" action="email.php" class="form">
<table>
<tr>
<td>
Name*
</td>
<td>
<input type="text" name="firstname" id="firstname">
</td>
</tr>
<tr>
<td>
Surname*
</td>
<td>
<input type="text" name="surname" id="surname">
</td>
</tr>
<tr>
<td>
Company name*
</td>
<td>
<input type="text" name="cname" id="cname">
</td>
</tr>
<tr>
<td>
Email*
</td>
<td>
<input type="text" name="email" id="email">
</td>
</tr>
<tr>
<td>
Telephone*
</td>
<td>
<input type="text" name="phone" id="phone">
</td>
</tr>
<tr>
<td>
Postcode*
</td>
<td>
<input type="text" name="pcode1" id="pcode1" size="" maxlength="8">
</td>
</tr>
<tr>
<td>
Message*
</td>
<td>
<textarea id="emassage" name="emessage" cols="67" rows="6"></textarea>
</td>
</tr>
<tr>
<td>
<button name="submit" id="submit" class="shiny-blue">Submit</button>
</td>
<td>
</td>
</tr>
</table>
</form>
</p>
</div>
</body>
</html>
콘솔, 404 등의 예외? –
어리석은 질문이지만이 HTML 또는 XHTML입니까? (즉, DOCTYPE은 XHTML이지만 http-equiv 메타는 HTML을 말합니다.) 이제 IE9가 최초의 IE이므로 실제로 그 사람들에게 말하면 어쩌면 혼란 스러울 지 모릅니다. 이전 IE는 XHTML에 대해 몰라 혼동하지 않을 것입니다. –
또한 모든 id 속성이 컨트롤의'name' 속성과 일치하는 것은 아닙니다. 예를 들어 textarea는 id = "emassage"이지만 name = "emessage"입니다. 이것이 중요한지 나는 모른다. 여기서 테스트 할 수 없습니다. –