当鼠标左键按住不放时,鼠标移动到按钮则触发按钮点击事件.若鼠标放开时,鼠标移动到按钮则不触发.
解决方案 »
- html标签
- document.all和document.getElementById的区别?
- 正则表达式
- js代码模块改由数据库中动态加载,妥否?
- 刷新问题~~来着都有分
- function函数如何传入一个参数,并返回这个参数。
- Jquery ui 弹出窗中如何加载别的页面,一定要用iframe吗
- 求jQuery高手帮我修改事件方法
- 关于对象中的 this.copy
- 新手问题--类似于列表框的table
- 想要用DIV制作无缝链接的广告哦,可是不知道哪错了,请高手指教一下,谢谢啦
- 理清apply, call的区别与联系--转载 http://www.bgscript.com/topics/thinkinginjs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="textml; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<div id="odiv" style="width:100px; height:100px; border:1px solid red">按住鼠标移上来</div>
<script type="text/javascript">
<!--
var isBound = false;
document.onmousedown = function(){
isBound = true;
}
document.onmouseup = function(){
isBound = false;
}
document.getElementById('odiv').onmouseover = function(){
if(!!isBound) this.style.backgroundColor = 'blue';
}
//-->
</script>
</body>
</html>