javascript - Why would this code work in IE and fail in Firefox and Chrome? -
so loading our new web application in firefox , chrome had alert subtly tell me tabstrip couldn't found. following through code found function:
function initializetabstrip() { var tbllist = document.getelementsbytagname("table"); var tabstrip = null; (var = 0; < tbllist.length; ++i) { if (typeof (tbllist[i].tabstriproot) != "undefined") { tabstrip = tbllist[i]; break; } } if (tabstrip) { window.tabstrip = new tabstrip(tabstrip); } else { alert("couldn't find tabstrip"); } }
in both firefox , chrome, typeof (tbllist[i].tabstriproot)
comes undefined, whereas in internet explorer same section of code find item, , follow through correctly.
i've tried using firebug , ie's developer toolbar script debugging tool follow through , attempt discover 'tabstriproot' is, haven't had luck.
would of javascript guru's able give me direction why 1 out of 3 browsers works?
thanks help.
you're relying on ie's non-standard ability access arbitrary attributes properties of dom elements.
in standards-compliant browsers, cannot write someelement.tabstriproot
access tabstriproot
attribute.
change tbllist[i].getattribute('tabstriproot')
.
Comments
Post a Comment