标签:alt 地方 鼠标 class pre 其他 img com bsp
镇场诗:
清心感悟智慧语,不着世间名与利。学水处下纳百川,舍尽贡高我慢意。
学有小成返哺根,愿铸一良心博客。诚心于此写经验,愿见文者得启发。
——————————————————————————————————————————
code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
.testDiv{
height:200px;
width:200px;
background-color:green;
}
</style>
<script type="text/javascript">
function MouseOver(obj)
{
obj.style.backgroundColor = "red";
}
function MouseOut(obj)
{
obj.style.backgroundColor = "green";
}
</script>
</head>
<body>
<div class="testDiv" onmouseover="MouseOver(this)" onmouseout="MouseOut(this)">
</div>
</body>
</html>
result:
鼠标放上

鼠标移开,

——————————————————————————————————————————
博文的精髓,在技术部分,更在镇场一诗。IDE: VS2015;浏览器: Firefox。
html+css+js,强,值得努力学习。传智播客的视频教程是我的学习资源,推荐。
如果博文有可以改进的地方,请留下评论,我会认真思考的。
注:我是一位正在努力的普通人,此文仅供测试与参考使用,不可做其他用途。当参考博文内容时,代表您已接受使用条款。
JavaScript基础 鼠标放上触发事件onmouseover 鼠标移开触发事件onmouseout
标签:alt 地方 鼠标 class pre 其他 img com bsp
原文地址:http://www.cnblogs.com/shemingli/p/6816914.html