亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

改變DIV樣式作業(yè)

??? 2018-12-19 08:53:41 206
????:以前不知道什么時(shí)候該用window.onload,工作中有時(shí)候遇到JS不執(zhí)行,雖然知道頁(yè)面沒加載完JS沒有找到對(duì)象,以前也只知道把JS移到最后面可以解決,現(xiàn)在知道可以加上window.onload,頁(yè)面加載完執(zhí)行,還是基礎(chǔ)知識(shí)不太牢固<!doctype html><html> <head>  <meta charset="UT

以前不知道什么時(shí)候該用window.onload,工作中有時(shí)候遇到JS不執(zhí)行,雖然知道頁(yè)面沒加載完JS沒有找到對(duì)象,以前也只知道把JS移到最后面可以解決,現(xiàn)在知道可以加上window.onload,頁(yè)面加載完執(zhí)行,還是基礎(chǔ)知識(shí)不太牢固

<!doctype html>

<html>

 <head>

  <meta charset="UTF-8">

  <meta name="Generator" content="EditPlus?">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

  <title>改變DIV樣式作業(yè)</title>

 </head>

 <style>

 #box{width:100px;height:100px;background:#f00}

 </style>

 <body>

<div id="box"></div>


<input type="button" value="變寬" onclick='changeWidth()'>

<input type="button" value="變高" onclick='changeHeight()'>

<input type="button" value="變色" onclick='changeBgColor()'>

<input type="button" value="重置" onclick='reset()'>

<input type="button" value="隱藏" onclick='hide()'>

<input type="button" value="顯示" onclick='show()'>


<script>

var box = document.getElementById('box');


function changeWidth(){

box.style.width='400px';

}


function changeHeight(){

box.style.height='400px';

}


function changeBgColor(){

box.style.backgroundColor='pink'

}


function reset(){

box.style.width='100px';

box.style.height='100px';

box.style.backgroundColor='red'

}


function hide(){

box.style.display='none';

}


function show(){

box.style.display='block';

}

</script>

 </body>

</html>


?? ???:滅絕師太?? ??:2018-12-19 09:39:34
???? ??:知識(shí)點(diǎn)不牢固的話,多練習(xí)就可以啦完成的不錯(cuò),繼續(xù)加油

??? ??

?? ??