2014年3月24日 星期一

Lab 16 Change an image by moving the mouse

Lab 15 九九乘法表


Lab 14 Create Image using DOM

<html>
 <head>
Click the button to call a photo<br />

<button onclick="build()">Try it</button>

<title>lab14</title>
 <script>
function build()
{
myImg =document.createElement("IMG")
myImg.setAttribute("id","imageOne")
myImg.setAttribute("src","http://airsnarf.shmoo.com/airsnarf.jpg")
docBody = document.getElementsByTagName("body").item(0)
docBody.appendChild(myImg)
}
window.onload=build
</script>
</head>
<body>
<br />
</body>
 </html>
Click the button to call a photo
lab14

2014年3月22日 星期六

Homework 3/10/2014: Lab 8 Using browsers for programming II

2014年3月17日 星期一

Lab 13 Regular expression in action II

Lab 12 Regular expression in action

search:

Lab 11 Regular Expression 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() {
 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= "請輸入整數或小數,逗號,整數或小數";
    notify.id ="notify";
 var body = document.getElementById("body");
 body.appendChild(notify);
 }
 }
 };
 </script>
 </html>