解决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
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
相关文章推荐
- IE8的JavaScript点击事件(onclick)不兼容的解决方法
- android onClick 事件中容易打开两个页面解决办法
- 解决iscroll5在手机页面上onclick事件失效
- div拖拽时取消文字选中默认事件的解决方法
- 鼠标选中一段文字变成C的解决
- IE8的JavaScript点击事件(onclick)不兼容的解决方法
- 页面选中文字弹出层,点击层中文字或者图片触发事件
- 解决iscroll5在手机页面上onclick事件失效
- IE8及以下 attr给标签追加onclick事件失效解决方法
- JS获取页面里鼠标选中的文字
- SecureCRT 或 Xshell 鼠标选中一行 则 自动跳到 下一行 的解决办法 。(鼠标选中文字 则 自动换行 ,或者自动ctrl+C)
- JSP页面onclick点击事件无法更换img标签里面的图片(例如点击更换验证码图片)
- Iframe 和父页面交互+Iframe 的onclick()事件
- 解决Extjs TextField回车事件后刷新页面问题
- iScroll4 禁止select等页面元素默认事件的解决方法 转
- 用js onselectstart事件鼠标禁止选中文字
- [问题记录]js将事件写在函数之前解决IE8的兼容性问题
- 解决:android TextView上响应部分文字的事件
- 解决后台修改数据后在IE8中刷新网页还是之前的页面的问题
- Xshell用鼠标选中一段文字后自动换行的问题