最新回應

Loading...

2014年4月28日 星期一

Lab 17 JavaScript

picture1
picture2
picture3

Lab 16 Change an image by moving the mouse

lab16

2014年4月14日 星期一

Lab 15 九九乘法表

<html>
<head>
    <meta content="text/html; charset=ISO-8859-1"
http-equiv="content type">
<title>lab15</title>

<script>

function buildTable()
{
docBody = document.getElementsByTagName("body").item(0)
myTable = document.createElement("TABLE")
myTable.id ="TableOne"
myTable.border = 1
myTableBody = document.createElement("TBODY")
for(i =1; i<10;i++){
row = document.createElement("TR")
for( j=1;j<10;j++){
cell = document.createElement("TD")
cell.setAttribute("WIDTH","50")
cell.setAttribute("HEIGHT","50")

textVal= j + "*" + i + "=" + i*j
textNode = document.createTextNode(textVal)
cell.appendChild(textNode)
row.appendChild(cell)
}
myTableBody.appendChild(row)
}
myTable.appendChild(myTableBody)
docBody.appendChild(myTable)
}

window.onload = buildTable

</script>
</head>
<body>
</body>
</html>




2014年4月9日 星期三

Lab 14 Create Image using DOM

<html>
<head>

<form action="javascript:void(0);" id="exampleForm">
<button onclick="build()">Try it</button>
<br />
</form>
<script>
function build()
   {
   myImg=document.createElement("IMG")
   myImg.setAttribute("id","imageOne")

   myImg.setAttribute("src","http://callalily.emmm.tw/sys/club_ieb/pic/37548_08.jpg")

   docBody = document.getElementsByTagName("body").item(0)
   var body = document.getElementById("exampleForm");
   body.appendChild(myImg)
}
</script>
</head>
<body>
<br />
</body>
</html>

Lab 13 Regular expression in action II

撰寫一個網頁能夠自動檢查輸入的字串是否為網址
id:0~255.0~255.0~255.0~255   為正確

其餘為錯誤




2014年4月7日 星期一

Lab 12 Regular expression in action





請依照google的規格來搜尋位置,以數字,逗點,數字
為搜尋格式

Lab 11 Regular Expression II

<html>
    <head>
    </head>
 <body id="body">
      <form action="javascript:void(0);" id="exampleForm2">
      <input  id="examplePass" />
   <input type="submit" />
      </form>
 </body>
 <script>

 document.getElementById("exampleForm2").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>


判斷此輸入是否符合此輸入不符合"整數或小數,逗號,整數或小數"格式