引之:http://taoistwar.iteye.com/blog/278963

今天做一个拖动效果,在网上找了个模板,作发后发现一拖动就会选择其它页面部分,需要去除这个效果,

找了个模板看了下发现有如下方法:只能被IE识别,

document.onselectstart=function(){return false}

优化后:(可能选择下拉列表框架)

document.onselectstart= function(event){
if(window.event) {
event =    window.event;
}
try {
var the = event.srcElement ;
if( !( ( the.tagName== "INPUT" && the.type.toLowerCase() == "text" ) || the.tagName== "TEXTAREA" ) )
{
return false;
}
return true ;
} catch(e) {
return false;
}
}

接着以找到用样式控制:

            body    
            {    
                    -moz-user-focus:   ignore;    
                    -moz-user-input:   disabled;    
                    -moz-user-select:   none;    
            }     

可以兼容FireFox.

最终解决。

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2021-12-20
  • 2021-07-07
  • 2021-07-08
  • 2021-05-26
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案