javascript作业:设置一个div框,显示(请将鼠标移进来),鼠标在框内显示(谢谢)
1个回答
2016-06-15
展开全部
<html>
<head>
<script type="text/javascript">
function mouseOver(){
document.getElementById('div1').innerHTML = "<p style='line-height:2em;text-align:center;'>谢谢</p>";
}
function mouseOut(){
document.getElementById('div1').innerHTML = "<p style='line-height:2em;text-align:center;'>请将鼠标移进来</p>";
}
</script>
</head>
<body>
<div id="div1" style="width:300px;border:1px solid white;" onmouseover="mouseOver()" onmouseout="mouseOut()" >
<p style="line-height:2em;text-align:center;">请将鼠标移进来</p>
</div>
</body>
</html>
先试试看
<head>
<script type="text/javascript">
function mouseOver(){
document.getElementById('div1').innerHTML = "<p style='line-height:2em;text-align:center;'>谢谢</p>";
}
function mouseOut(){
document.getElementById('div1').innerHTML = "<p style='line-height:2em;text-align:center;'>请将鼠标移进来</p>";
}
</script>
</head>
<body>
<div id="div1" style="width:300px;border:1px solid white;" onmouseover="mouseOver()" onmouseout="mouseOut()" >
<p style="line-height:2em;text-align:center;">请将鼠标移进来</p>
</div>
</body>
</html>
先试试看
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询