当前位置: 移动技术网 > IT编程>开发语言>JavaScript > js坚持不懈之17:onmousedown、onmouseup 以及 onclick 事件

js坚持不懈之17:onmousedown、onmouseup 以及 onclick 事件

2019年02月20日  | 移动技术网IT编程  | 我要评论
<!doctype html>
<html>
<body>
<div onmouseover = "mover(this)" onmouseout = "mout(this)" style = "background-color:green;width:120px;height:20px;padding:40px;color:#ffffff;">把鼠标移到上面</div>

<script>
function mover(obj)
{
    obj.innerhtml = "谢谢"
}

function mout(obj)
{
    obj.innerhtml = "把鼠标移到上面"
}
</script>
</body>

</html>

2.

<!doctype html>
<html>
<body>

<div onmousedown = "mdown(this)" onmouseup = "mup(this)" style = "background:green;color:#ffffff;width:90px;height:20px;padding:40px;font-size:12px;">请点击这里</div>

<script>
function mdown(obj)
{
    obj.style.backgroundcolor = "#1ec5e5";
    obj.innerhtml = "请释放鼠标按钮"
}

function mup(obj)
{
    obj.style.backgroundcolor = "green";
    obj.innerhtml = "请按下鼠标按钮"
}
</script>

</body>
</html>

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网