サマリー:<!DOCTYPE html> <html> <head> <title> 改變DIV </title> <style type="text/css"> #box{width: 100px;height: 100px;background: r
<!DOCTYPE html> <html> <head> <title> 改變DIV </title> <style type="text/css"> #box{width: 100px;height: 100px;background: red;margin: 20px 80px;} </style> <script type="text/javascript"> var box; window.onload=function () { box=document.getElementById('box'); } function aa() { box.style.height="400px" //改變高度 } function bb() { box.style.width="400px" //改變寬度 } function cc() { box.style.background="pink" //改變顏色 } function dd() { box.style.height="100px" //重置 box.style.width="100px" box.style.background="red" } function ee() { box.style.display="none" //隱藏 } function ff() { box.style.display="block" //顯示 } </script> </head> <body> <div id="box"></div> <input type="button" value="變高" onclick="aa()"> <input type="button" value="變寬" onclick="bb()"> <input type="button" value="變色" onclick="cc()"> <input type="button" value="重置" onclick="dd()"> <input type="button" value="隱藏" onclick="ee()"> <input type="button" value="顯示" onclick="ff()"> </body> </html>
用了三天時間,做了6次,今天代碼終于實現(xiàn)功能了。又認(rèn)真看了幾次的代碼,發(fā)現(xiàn)也沒有問題啊,都是一樣的,為啥就不成功呢?難道是因為今天換了一臺電腦。。。。。。。
JS快學(xué)完了,但是好象學(xué)會了,又好象什么都沒有學(xué)會。每次看到代碼都能看懂,但是自己寫起的時候,不看筆記就不會寫了。還是沒有完全吃透啊。
添削の先生:天蓬老師添削時間:2018-12-17 15:44:38
先生のまとめ:有這么復(fù)雜嗎? 為了實現(xiàn)一個功能, 還換了一臺電腦, 只想問一聲: 兄弟, 腎, 還好嗎?