EL
2014年6月16日 星期一
lab11
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="text" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit =function() {
var passwordRegex = /^[+-]?\d+[.]?\d*[,][+-]?\d+[.]?\d*$/;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if (notify === null){
notify = document.createElement("p");
notify.textContent = " ERROR ";
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
lab 12
<html>
<title>lab12</title>
<body>
<form action="http://maps.google.com/maps" method="get" name="f" onsubmit="return check()">
<input name="q" type="text" /><br />
<input name="send" type="submit" value="search" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit =function() {
var passwordRegex = /^[-|+]*[\d]*[.|\d][\d]*[,][-|+]*[\d]*[.|\d][\d]*$/;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if (notify === null){
notify = document.createElement("p");
notify.textContent = "你不是正確的"
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>lab12
<title>lab12</title>
<body>
<form action="http://maps.google.com/maps" method="get" name="f" onsubmit="return check()">
<input name="q" type="text" /><br />
<input name="send" type="submit" value="search" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit =function() {
var passwordRegex = /^[-|+]*[\d]*[.|\d][\d]*[,][-|+]*[\d]*[.|\d][\d]*$/;
if(!passwordRegex.test(document.getElementById("examplePass").value)){
console.log("Regex didn't match");
var notify = document.getElementById("notify");
if (notify === null){
notify = document.createElement("p");
notify.textContent = "你不是正確的"
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
訂閱:
文章 (Atom)