2014年4月28日 星期一

Lab20 Hand code a form

<html>
<title>Lab20 </title>
<body>
<form action="http://maps.google.com/maps" method="GET" name="f" onsubmit="return check()">
 
Search Position: <input name="q" type="text" />
<input type="submit" value="提交資料" />
</form>
<script>

   

       
function check(){
     var floatReg =/^\d+(\.\d+)?,[+-]\d+(\.\d+)?$/;
         if(!floatReg.test(f.q.value)){
           
                alert("It's not a correct format");
            f.q.value="";
            document.f.q.focus();
            return false;
       
         }
}

</script>              

</body>
</html>



Lab19 Lab Form and Action

<html>
<body>
<FORM  METHOD="GET" ACTION="http://google.com/search" NAME="f" >
Search Page: <INPUT TYPE="text" NAME="q" >
<INPUT TYPE="submit" VALUE="提交資料">
</FORM>
</body>
</html>
Search Page:

Lab18 change pictures

<img  border="0" src="http://cycling.tbnet.org.tw/wp-content/uploads/2012/09/3485826991_cdf2bc6944_o.jpg" height="228" onmouseout="src='http://cycling.tbnet.org.tw/wp-content/uploads/2012/09/3485826991_cdf2bc6944_o.jpg'" onmouseover="src='http://www.hlpb.gov.tw/userfiles/20130724184001692031452.jpg'" width="304"  alt="This is a picture, it will change itself when you point it by your mouse." />




This is a picture, it will change itself when you point it by your mouse.

2014年4月14日 星期一

Lab 17 JavaScript

1
2
3

Lab 16 Change an image by moving the mouse

<img alt="Pulpit rock" border="0" src="http://cycling.tbnet.org.tw/wp-content/uploads/2012/09/3485826991_cdf2bc6944_o.jpg" height="228" onmouseout="src='http://cycling.tbnet.org.tw/wp-content/uploads/2012/09/3485826991_cdf2bc6944_o.jpg'" onmouseover="src='http://www.hlpb.gov.tw/userfiles/20130724184001692031452.jpg'" width="304" />




Pulpit rock

Lab 15 九九乘法表


<html>
<head>
<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 <= 9; i++){
    row = document.createElement("TR")
    for (j = 1; j <= 9; j++){
      cell = document.createElement("TD")
      cell.setAttribute("WIDTH","50")
      cell.setAttribute("HEIGHT","50")
      textVal = i+"*"+j+"="+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月7日 星期一

Lab 14 Create Image using DOM

<html>
<head>

<title>lab26</title>
<script>
function build()
{
myImg=document.createElement("IMG")
myImg.setAttribute("id","imageOne")
<!--myImg.setAttribute("src","http://airsnarf.schmoo.com/airsnarf.jpg")-->
myImg.setAttribute("src","http://roxy.com.tw/wp/BonJovi.jpg")
docBody=document.getElementsByTagName("body").item(0)
docBody.appendChild(myImg)

}
window.onclick=build

<!--<button><img src= "http://airsnarf.schmoo.com/airsnarf.jpg"></button>-->
<!--<button><img src= "http://roxy.com.tw/wp/BonJovi.jpg"></button>-->

</script>

<input onclick="http://roxy.com.tw/wp/BonJovi.jpg'" type="button" value="open_pic" />


</head>
<body>
<br />
</body>
</html>



lab26