2014年4月19日 星期六

Lab 17 JavaScript

picture1
picture2
picture3

Lab 16 Change an image by moving the mouse

Lab 15 九九乘法表

<html>
<body>
<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>
 </body>
 </html>

2014年4月12日 星期六

Lab 14 Create Image using DOM

<html>
<head>
<body>
<p>click the button to call the picture</p>
<button onclick="build()">Try it</button>
</body>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <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)


}

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