<div>与嵌套<div>事件问题 <div id="father" onmousedown="fun1(a,b,c)"> <div id="son" onmousedown="fun2(c,d,e)"> xxxxx </div></div>有什么办法在son里面点击鼠标时,不相应father的鼠标点击事件? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 位置不固定。两个onmousedown都是拖拽功能。在考虑这是不是可以用停止冒泡来解决,但是不知道怎么弄。 取消事件冒泡...<html><body><script type="text/javascript">function fun1(){ alert("fun1");}function fun2(oEvent, c, d, e){ oEvent = oEvent || window.event; alert("fun2"); if(document.all){ oEvent.cancelBubble = true; }else{ oEvent.stopPropagation(); }}</script><div id="father" onmousedown="fun1(event, 'a','b','c')"> <div id="son" onmousedown="fun2(event, 'c','d','e')"> xxxxx </div></div></body></html> <div id="father" onmousedown="fun1()"> fun1; <div id="son" onmousedown="fun2();return false;"> xxxxx fun2 </div> fun1;</div><script>var fun2run = false;function fun1(){ if (fun2run){fun2run=false;return} alert(1)}function fun2(){ fun2run=true; alert(2)}</script> 只用onmousedown="event.cancelBubble=true"就行了 EXTJS 可编缉的GridPanl 用户控件,三个DROPDOWNLIST实现省市县的无刷新三级联动 ext2.0分页问题? javascript中的特殊字符转义 求关于javascript中一个树状菜单的问题 如何延时执行教本? 菜鸟问题:javascript里的值怎么传递给vbscript? 请问如何得到下拉框中的项目总数 怎样给type="file"的 value 属性填入 初始化值呢??? 单元格内容自动换行后,如何取得单元格的真正高度,或内容行数? Jquery中关于盒子模型 JS调用后台函数出现奇怪问题
位置不固定。两个onmousedown都是拖拽功能。在考虑这是不是可以用停止冒泡来解决,但是不知道怎么弄。
<html>
<body>
<script type="text/javascript">
function fun1(){
alert("fun1");
}
function fun2(oEvent, c, d, e){
oEvent = oEvent || window.event;
alert("fun2");
if(document.all){
oEvent.cancelBubble = true;
}else{
oEvent.stopPropagation();
}
}
</script>
<div id="father" onmousedown="fun1(event, 'a','b','c')">
<div id="son" onmousedown="fun2(event, 'c','d','e')">
xxxxx
</div>
</div>
</body>
</html>
fun1;
<div id="son" onmousedown="fun2();return false;">
xxxxx fun2
</div>
fun1;
</div>
<script>
var fun2run = false;
function fun1(){
if (fun2run){fun2run=false;return}
alert(1)
}
function fun2(){
fun2run=true;
alert(2)
}
</script>