很艰难的啃着这块js烧饼(英文单词记不住,个人感觉)

Original 2019-02-21 17:07:03 249
abstract:<!DOCTYPE html><html><head> <title>js控制div</title> <style type="text/css"> #box{width:150px;height:150px;background:#ccc;text-align:center;margin:20px 65p

<!DOCTYPE html>

<html>

<head>

<title>js控制div</title>

<style type="text/css">

#box{width:150px;height:150px;background:#ccc;text-align:center;margin:20px 65px}



</style>

</head>

<body>


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

<input type="button" value="变高" onclick="zg()">

<input type="button" value="变宽" onclick="zk()">

<input type="button" value="变色" onclick="bs()">

<input type="button" value="变圆角" onclick="byj()">

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

<input type="button" value="隐藏" onclick="yc()">

<input type="button" value="显示" onclick="xs()">

<input type="button" value="写入" onclick="xr()">

<input type="button" value="换图" onmouseover="ys()">

<input type="hidden" id="imgsrc">


<script type="text/javascript">

    var box

window.onload=function (){


      box=document.getElementById("box")

      

}

function zg(){

      box.style.height="300px"

      

      }

     function zk(){

      box.style.width="300px"



     }

     function bs(){


     box.style.background="red"


     }

     function cz(){

      box.style.width="150px"

      box.style.height="150px"

      box.style.background="#ccc"

      box.style.borderRadius="0px"

      box.innerHTML=""

     }

     function yc(){

       box.style.display="none"


     }

     function xs(){

      box.style.display="block"



     }

     function byj(){

      box.style.borderRadius="50px"



     }

     function xr(){


      box.innerHTML="<img id='image'src='images/timg.jpg' onmouseover='overs()' onmouseleave='leaves()'/>"

      box.style.textAlign="center"

      box.style.lineHeight="150px"


     }

     function ys(){

       document.getElementById('image').src="images/1.jpg"

        


     }

     function overs(){

document.getElementById('imgsrc').value = document.getElementById('image').src;

document.getElementById('image').src = 'images/timg.jpg';

}


// 鼠标移出img

function leaves(){

document.getElementById('image').src = document.getElementById('imgsrc').value;

}

</script>

</script>


</body>

</html>

经过老师指导才知道鼠标移上元素和移出元素可以这样用,谢谢勒,下一步就是多多练习剩余的获取方式,主要是单词记不住,老容易忘记需要查书册,问老师,我感觉还是不熟练


Correcting teacher:韦小宝Correction time:2019-02-21 17:29:26
Teacher's summary:单词记不住很正常 哪有能把所有单词都记住的呢 要知道怎么去查就可以了

Release Notes

Popular Entries