.firefox不能对innerText支持,也不知道为什么。firefox支持innerHTML但却不支持innerText,所以上网查了一下,原来它改支持textContent来实现innerText,不过实现得没有那么好,默认把多余的空格也保留了。如果不用textContent,如果字符串里面不包含HTML代码也可以用innerHTML代替
2.禁止选取网页内容:
在IE中一般用js:obj.onselectstart=function(){return false;}
而firefox用CSS:-moz-user-select:none
3.滤镜的支持(例:透明滤镜):
IE:filter:alpha(opacity=10);
firefox:-moz-opacity:.10;
4.捕获事件:
IE:event.attachEvent("onmousemove",mousemovefunction") ,event.detachEvent("onmousemove",mousemovefunction)
Firefox: event.addEventListener("mousemove",mousemovefunction,false);
event.removeEventListener("mousemove",mousemovefunction,true);
5.获取事件对象:
var eve = event || window.event;
6.DIV等元素的边界问题:
比如:设置一个div的CSS::{width:100px;height:100px;border:#000000 1px solid;}
IE中:div的宽度(包括边框宽度):100px,div的高度(包括边框宽度):100px;
而firefox:div的宽度(包括边框宽度):102px,div的高度(包括边框宽度):102px;
所以在做这个兼容IE和firefox的拖动窗口时,在js和css的写法上要动点脑筋,给大家两个小技巧
一.判断浏览器类型:
var isIE=document.all? true:false;
我写了一个变量,如果支持document.all语法那么isIE=true,否则isIE=false
.document.documentElement 与 document.body
代码中设置页面的CSS时一定要用:document.documentElement
比如:document.documentElement.style.overflow='hidden';
overflow-X、overflow-Y 这两个分坐标属性XHTML是不支持的;
2.在取得网页窗口区域和获取滚动条位移距离时也要用document.documentElement
即这四个属性(clientWidth、clientHeight、scrollLeft、scrollTop)一定要用document.documentElement
但是document.body.appendChild()和document.body.removeChild()却是可以用的,而且用document.documentElement.appendChild()和document.documentElement.removeChild()代替却会报错;
**********所以我总结了一下仅clientWidth、clientHeight、scrollLeft、scrollTop和document.documentElement.style时才用document.documentElement
2.禁止选取网页内容:
在IE中一般用js:obj.onselectstart=function(){return false;}
而firefox用CSS:-moz-user-select:none
3.滤镜的支持(例:透明滤镜):
IE:filter:alpha(opacity=10);
firefox:-moz-opacity:.10;
4.捕获事件:
IE:event.attachEvent("onmousemove",mousemovefunction") ,event.detachEvent("onmousemove",mousemovefunction)
Firefox: event.addEventListener("mousemove",mousemovefunction,false);
event.removeEventListener("mousemove",mousemovefunction,true);
5.获取事件对象:
var eve = event || window.event;
6.DIV等元素的边界问题:
比如:设置一个div的CSS::{width:100px;height:100px;border:#000000 1px solid;}
IE中:div的宽度(包括边框宽度):100px,div的高度(包括边框宽度):100px;
而firefox:div的宽度(包括边框宽度):102px,div的高度(包括边框宽度):102px;
所以在做这个兼容IE和firefox的拖动窗口时,在js和css的写法上要动点脑筋,给大家两个小技巧
一.判断浏览器类型:
var isIE=document.all? true:false;
我写了一个变量,如果支持document.all语法那么isIE=true,否则isIE=false
.document.documentElement 与 document.body
代码中设置页面的CSS时一定要用:document.documentElement
比如:document.documentElement.style.overflow='hidden';
overflow-X、overflow-Y 这两个分坐标属性XHTML是不支持的;
2.在取得网页窗口区域和获取滚动条位移距离时也要用document.documentElement
即这四个属性(clientWidth、clientHeight、scrollLeft、scrollTop)一定要用document.documentElement
但是document.body.appendChild()和document.body.removeChild()却是可以用的,而且用document.documentElement.appendChild()和document.documentElement.removeChild()代替却会报错;
**********所以我总结了一下仅clientWidth、clientHeight、scrollLeft、scrollTop和document.documentElement.style时才用document.documentElement