日期:2014-05-17  浏览次数:20687 次

IE与firefox兼容JS和CSS
    这几天都在调试IE与火狐的兼容,自己基本上在这方面没什么经验,就是在网上荡资料来解决问题,兼容样式、JS对象、报表等等。
     直接贴代码吧。
function client_OnTreeNodeChecked(e) {
        var obj;
        //判断浏览器
        if (!document.all) {
            e = window.event || e;
            obj = e.srcElement || e.target;
        } else {
           //IE
            obj = window.event.srcElement;
        }
       
            var treeNodeFound = false;
            var checkedState;
           
            if (obj.tagName == "INPUT" && obj.type == "checkbox") {
                var treeNode = obj;
                checkedState = treeNode.checked;
                do {
                    if (document.all) {
                        obj = obj.parentElement;
                    } else {
                          obj = obj.parentNode;
                    }
                } while (obj.tagName != "TABLE")
                var parentTreeLevel = obj.rows[0].cells.length;
                var parentTreeNode = obj.rows[0].cells[0];
                var tables;
                if(document.all){
                   tables = obj.parentElement.getElementsByTagName("TABLE");
                }else{
                   tables = obj.parentNode.getElementsByTagName("TABLE");
                }
                var numTables = tables.length
                if (numTables >= 1) {
                    for (i = 0; i < numTables; i++) {
   &nb