直接贴我写的代码哈:求大神给指证我的错误在哪里谢谢;
html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>鼠标移入事件</title> <style type="text/css"> .dj{ width: 300px; height: 500px; background-color: #333333; display:none; } </style> <script type="text/javascript"> window.onload = function (){ var xod1=document.getElementById("as"); xod1.onmouseover= function (){ var xoda2=document.getElementById("dgil"); xoda2.style.display='block'; } } </script> </head> <body> <p style="width: 50px; height: 50px;background: #33ccdd;" id="as"></p> <p class="dj" id="dgil">dd</p> </body> </html>
黄舟2017-04-10 14:53:22
题主是还想让其隐藏吗?
<script type="text/javascript">
window.onload = function (){
var xod1=document.getElementById("as");
xod1.onmouseover= function (){
var xoda2=document.getElementById("dgil");
if(xoda2.style.display=='none')
xoda2.style.display='block';
else
xoda2.style.display='none';
}
}
</script>