老师帮忙看下代码
来源:2-7 编程练习
贾海洋
2020-06-13 21:28:42
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML事件</title>
<style>
div{
width:80px;
height:30px;
line-height:30px;
border:solid 1px rgba(0,0,0,0.5);
text-align:center;
float:left;
background:#EAEAEA;
border-radius:2PX;
}
.btn1{
margin-left:30px;
}
</style>
</head>
<body>
<!--补充代码-->
<div class="btn" onmouseover="mouseOver(this,'#A424DB')" onmouseout="mouseOut(this,'gray')">开始</div>
<div class="btn1" onmouseover="mouseOver(this,'yellow')" onmouseout="mouseOut(this,'gray')">开始</div>
<script type="text/javascript">
//补充代码
function mouseOver(btn,bgColor){
btn.style.color=bgColor;
}
function mouseOut(btn,bgColor){
btn.style.color=bgColor;
}
</script>
</body>
</html>
1回答
同学你好,代码实现的是正确的。继续加油,祝学习愉快~
相似问题