zoukankan      html  css  js  c++  java
  • 去除HTML选择——兼容IE、FireFox(document.onselectstart,样式)

    引之: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.

    最终解决。

  • 相关阅读:
    【Algorithm】基数排序
    【Algorithm】堆排序
    【Algorithm】快速排序
    【Algorithm】自顶向下的归并排序
    【Algorithm】自底向上的归并排序
    【Algorithm】插入排序
    【Algorithm】选择排序
    java的几个format
    java restful接口
    java解析EXCEL
  • 原文地址:https://www.cnblogs.com/icelin/p/3939553.html
Copyright © 2011-2022 走看看