您的位置:首页 > 其它

解决IE8将“在页面中选中一段文字”误认为是Onclick 事件

2011-04-22 12:16 429 查看
If a div has a onclick event but you do not
want onclick event happen when you use mouse to select some text

onmousedown="mousedownInContacts();" onmousemove="mousemoveInContacts();" onmouseup="mouseupInContacts(this);"
var ifMousedown=false;
var ifMousemove=false;
function mousedownInContacts(){
ifMousedown=true;
}
function mousemoveInContacts(){
if(ifMousedown){
ifMousemove=true;
}
}
function mouseupInContacts(e){
if(!ifMousemove){
childrenToggle(e);//this is what onclick event want to do
}

ifMousemove=false;
ifMousedown=false;
}

1 JQuery issue
When ajax
load the html page with javascript it will execute the javascript and then put
it into random access memory. then javascript code will not execute when we
called it in the html page.

Thanks my leader Frank's guid
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: