<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input id="examplePass" type="text" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit =function() {
var passwordRegex = /^[\d]*[.]*[\d]*[.]*[\d]*[.]*[\d]|*\w{1,}*[.]*\w{1,}*[.]*\w{1,}*[.]*(\w{1,})$/;
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 = "not 正確的。"
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
2014年3月17日 星期一
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 = "not 正確的。"
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
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]*[.|\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 = "not 整數 or 小數 逗號 整數或小數。"
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
lab10
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="password" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit =function() {
var passwordRegex = /^[-|+]*[\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 = "not 整數 or 小數。"
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
2014年3月10日 星期一
Lab 8 Using browsers for programming II
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="password" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit = function() {
//R
var passwordRegex = /^[\D]+[\W_]+[A-Za-z\d]{4,}$/;
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 = "Passwords need to >= 6 characters long and a 小寫英文與非字母 排序第一個為字母第二個為符號."
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
Lab 7 Using browsers for programming
<html>
<head>
</head>
<body id="body">
<form action="javascript:void(0);" id="exampleForm">
<input type="password" id="examplePass" />
<input type="submit" />
</form>
</body>
<script>
document.getElementById("exampleForm").onsubmit = function() {
//R
var passwordRegex = /^[A-Za-z\d]{6,}$/;
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 = "Passwords need to be between 6 and 8 characters long and consist of uppercase characters,lowercase characters, and digits only."
notify.id = "notify";
var body = document.getElementById("body");
body.appendChild(notify);
}
}
};
</script>
</html>
訂閱:
文章 (Atom)