All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
网页制作兼容Mozilla必须知道的知识_JavaScript技术_编程技术

Writer: delv Article type: Programming skills(编程技巧) Time: 2013/12/31 6:51:06 Browse times: 360 Comment times: 0

网页制作兼容Mozilla必须知道的知识_JavaScript技术_编程技术


Head photo

Go homepage
Upload pictures
Write articles

网页制作兼容Mozilla必须知道的知识_JavaScript技术_编程技术-你的首页-uuhomepage.com
IEMozilla说明
document.all(id)document.getElementById(id)
document.alldocument.getElementsByTagName("*")
document.body.clientHeight(clientWidth)根据HTML的DTD而定方能得到准确值。window.innerHeight(innerWidth)根据HTML的DTD而定方能得到准确值。
opacity(aplha=20)MozOpacity="0.2"可参看我的blog这篇文章
event.clientY(clientX)event.pageY(pageX)
event.keyCodeevent.which
event.srcElementevent.target
window.external.AddFavorite('never-online.net', "never-online'website"); window.sidebar.addPanel('never-online.net', "never-online'website", "");
event.clientY(clientX)event.pageY(pageX)
(DHTML事件-滚轮事件)onmousewheelDOMMouseScroll可参看我的blog这篇文章
window.showModalDialogwindow.open(url, "name", "modal=yes")
createPopup()xul
htc控件xbl绑定
filter滤镜只支持alpha(透明度,部分可通过clip来模拟)
obj.setCapture()window.captureEvents(Event.eventType)
obj.attachEvent(type, listener)obj.addEventListener(type, listener, useCapture)
obj.detachEvent(type, listener)obj.removeEventListener(type, listener, useCapture)
脚本预解释执行
o={   foo: function(){     alert("never-online");   } }; with (o) {  bar();  function bar(){     alert("never-online");  }   foo(); }
上面的代码成功输出never-online
脚本顺序执行。o={   foo: function(){     alert("never-online");   } }; with (o) {  bar();  function bar(){     alert("never-online");  }   foo(); }
报错bar未定义
解决方法有很多种,请参见我这里的评论或者这篇文章
支持Webdings字体不支持Webdings字体
insertAdjacentHTML, insertAdjacentElement方法本身不支持,但可通过insertBefore或通过Range实现可参见我这篇文章的代码
不支持读写器__defineSetter(Getter)__
不支持支持对Element,EVENT等对象的prototype模式支持
不支持对节点有nodeType常量属性
new ActiveXObject("MSXML2.XMLHTTP")或更高版本的ProgIdXMLHttpRequest对象
设置类似style.top=20这样的高度时,可不使用单位设置类似style.top=20+'px'这样的高度时,必须使用单位,否则无效
CSS的类名,不区分大小写(大小写不敏感)CSS的类名,区分大小写(大小写敏感)如:.myCss和.mycss类名就是不相同的
冒泡事件event.cancelBubble=trueevent.stopPropagation()(需要传递event事件)
parentElement默认不支持,但可以利用Mozilla特性模拟
HTMLElement.prototype.__defineGetter__("parentElement", function () {if (this.parentNode == this.ownerDocument) return null;return this.parentNode;});
无空白节点因为Mozilla下NodeType下定义有12种节点属性,所以要去除空白的节点方能得到预期值
  var notspace = /\S/;  function cleanWhitespace(node) {    for (var x=0; x<node.childNodes.length; x++) {      var child = node.childNodes[x];      if ((child.nodeType == 3) && (!notspace.test(child.nodeValue))) {        node.removeChild(node.childNodes[x]); x--;      }; if(child.nodeType == 1) { cleanWhitespace(child); }    }  }
CSS padding宽度并不在offset偏移坐标之内CSS padding宽度默认是在offset偏移坐标之内,可用-moz-box-sizing:border-box来设置即可基本与IE相同可参见我这篇文章的代码
js动态加载xslt文件将xml转化成HTML,IE可用xmldoc.transformNode(xslDocument)方法Mozilla中相对麻烦一些,要经过几道工序XSLTProcessor对象,transformToFragment或其它方法





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.