顯示具有 3/17 標籤的文章。 顯示所有文章
顯示具有 3/17 標籤的文章。 顯示所有文章

2014年3月17日 星期一

lab13

<html> <head> </head> <body id="body"> <form action="javascript:void(0);" id="exampleForm"> <input id="examplePass" type="text" /> <input type="submit" /> </form> <script> document.getElementById("exampleForm").onsubmit = function(){ var passwordRegex =/^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/; 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("exampleForm"); body.appendChild(notify); } } }; </script>

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 = "你不是正確的"
   notify.id = "notify";

   var body = document.getElementById("body");
   body.appendChild(notify);
   }
  }
 };

  </script>
</html>

Lab11


Lab10