如何防止浏览器中文本被选中呢?
IE中,使文本所在控件的onselectstart事件返回false
window.οnlοad=function()
{
var moveSpan222=$('#moveSpan');
//alert(moveSpan222);
drag(moveSpan222);
if(isIEtest){//当浏览器是IE时
com.whuang.hsj.$$id('moveSpan').onselectstart=function()//禁止文本被选中
{
return false;
}
}
}
火狐和chrome中,使用css
.cannot_select{
-moz-user-select:none;/*火狐*/
-webkit-user-select:none;/*webkit浏览器*/
-ms-user-select:none;/*IE10*/
-khtml-user-select:none;/*早期浏览器*/
user-select:none;
}
参考:http://www.baidu.com/link?url=TWlih_4XiCKFqWH7G4YRn_BscjzgEh8gQY2349euHmf2lWvc3USO3_FnP6LVMpbO3L-r5wH8T8_pz3PJpeHd6q