abstrait:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>完成自己想做的事</title>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>完成自己想做的事</title>
<style type="text/css">
#box{width: 200px;height: 200px;background: skyblue;margin: 40px 100px;}
</style>
</head>
<body>
<script type="text/javascript">
var box
window.onload=function (){
box=document.getElementById('box')
}
function aa() {
box.style.height="600px"
}
function bb() {
box.style.width="600px"
}
function cc() {
box.style.background="black"
}
function dd() {
box.style.height="200px"
box.style.width="200px"
box.style.background="pink"
function ee() {
box.style.display="none"
}
function ff() {
box.style.display="block"
}
</script>
<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>
對于第一步,先去把box給整合后,這樣很方便。就算繼續(xù)添加其他按鈕,也讓頁面中的代碼量沒有看起來那么龐大。
Professeur correcteur:西門大官人Temps de correction:2019-02-17 09:55:39
Résumé du professeur:作業(yè)寫的很好,思路也很好。以后寫js代碼的時候最好加一下分號