abstrakt:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>mydiv</title><style type="text/css">#mydiv{width:100px;height:100px;background: re
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>mydiv</title>
<style type="text/css">
#mydiv{width:100px;height:100px;background: red; margin: 20px 90px;}
/* #bi{margin-left:100px;} */
</style>
</head>
<body>
<div id="mydiv"></div>
<input type="button" value="變高" onclick="aa()" id="bi">
<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()">
<script type="text/javascript">
var mydiv
var bi
window.onload=function(){
mydiv=document.getElementById('mydiv');
bi=document.getElementById('bi');
}
function aa(){
mydiv.style.height="400px";
}
function bb() {
mydiv.style.width="400px";
bi.style.marginLeft="150px";
}
function cc() {
mydiv.style.background="pink"
}
function dd() {
mydiv.style.height="100px";
mydiv.style.width="100px";
mydiv.style.background="red";
bi.style.marginLeft="2px";
mydiv.style.marginLeft="90px"
}
function ee() {
mydiv.style.display="none"
}
function ff(){
mydiv.style.display="block"
}
</script>
</body>
</html>
Korrigierender Lehrer:滅絕師太Korrekturzeit:2019-02-11 09:58:16
Zusammenfassung des Lehrers:上課案例測試比較簡單,可以結(jié)合案例練習(xí)哦