abstract:總結(jié)css樣改變時格式:style.width。。。。等<!DOCTYPE html><html><head> <title></title> <style type="text/css"> .box{ width: 100px; height: 100px; background: pink
總結(jié)
css樣改變時格式:style.width。。。。等
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.box{
width: 100px;
height: 100px;
background: pink;
margin: 50px 80px;
}
</style>
</head>
<body>
<div class ="box">
</div>
<input type="button" name="" value="變高" onclick="hei()">
<input type="button" name="" value="變寬" onclick="wid()">
<input type="button" name="" value="變色" onclick="bac()">
<input type="button" name="" value="重置" onclick="rec()">
<input type="button" name="" value="隱藏" onclick="hid()">
<input type="button" name="" value="顯示" onclick="hids()">
<script type="text/javascript">
var box
window.onload=function(){
box=document.getElementsByClassName('box')[0];
}
function hei(){
box.style.height="400px";
}
function wid(){
box.style.width="400px";
}
function bac(){
box.style.background="green";
}
function rec(){
box.style.height="100px";
box.style.width="100px";
box.style.background="pink";
box.style.borderRadius="0px";
}
function hid(){
box.style.display="none";
}
function hids(){
box.style.height="400px";
box.style.width="400px";
box.style.background="pink";
box.style.display="block";
box.style.borderRadius="200px";
}
</script>
</body>
</html>
Correcting teacher:天蓬老師Correction time:2019-04-01 09:42:00
Teacher's summary:你的函數(shù)命名, 好清新呀 , 居然沒看出意義來, 下次用一些有意義的名稱, 通常函數(shù)是一系列的運作, 建議使用動賓結(jié)構(gòu), 例如: setColor(), getName()之類的