abstrait:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> #box{ height: 100
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> #box{ height: 100px; width: 100px; background: red; } </style> </head> <body> <div id="box"></div> <input type="button" value="高度" onclick="edit_height()"> <input type="button" value="寬度" onclick="edit_width()"> <input type="button" value="顏色" onclick="edit_background()"> <input type="button" value="還原" onclick="edit_res()"> <input type="button" value="隱藏" onclick="edit_hide()"> <input type="button" value="顯示" onclick="edit_show()"> <script type="text/javascript"> var box window.onload=function(){ box=document.getElementById('box') } function edit_height(){ box.style.height="200px" } function edit_width(){ box.style.width="200px" } function edit_background(){ box.style.background="blue" } function edit_res(){ box.style.height="100px" box.style.width="100px" box.style.background="red" } function edit_hide(){ box.style.display="none" } function edit_show(){ box.style.display="block" } </script> </body> </html>
屬性后面沒(méi)有分號(hào)
window.onload是頁(yè)面加載完成后才會(huì)執(zhí)行
Professeur correcteur:天蓬老師Temps de correction:2019-04-10 09:46:02
Résumé du professeur:你的函數(shù)命名, 是我喜歡的風(fēng)格, 不錯(cuò)的, 就應(yīng)該使用這種動(dòng)名組合