鼠标移上去变红色,点击变蓝色,移走的时候变回白色

Original 2019-03-08 15:07:11 723
abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>js动画</title> </head> <body> <div style="width: 200px;h
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>js动画</title>
</head>
<body>
<div style="width: 200px;height: 200px;border: 1px solid black;margin: 0 auto;" onmouseover="myonmouseover(this)" onmouseout="myonmouseout(this)" onmousedown="myonmousedown(this)"></div>
<script type="text/javascript">
function myonmouseover(x){
x.style.background="#f40"
}
function myonmouseout(y){
y.style.background="#fff"
}
function myonmousedown(z){
z.style.background="blue"
}
</script>
</body>
</html>


Correcting teacher:韦小宝Correction time:2019-03-09 09:08:56
Teacher's summary:写的很不错 JavaScript中重要的也就是获取元素 来对元素进行改变

Release Notes

Popular Entries