2014年3月17日 星期一

lab12

<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 = "error" notify.id = "notify"; var body = document.getElementById("body"); body.appendChild(notify); } } }; </script> </html> lab12

沒有留言:

張貼留言