montego237
Technical User
Hi,
I understand that the javascript in IE5 doesn't support the PUSH() method of arrays, and have been researching and discovered that you need the add on:
if (typeof Array.prototype.push == "undefined") {
Array.prototype.push = function(str) {
this[this.length] = str;
}
}
however, does this need tweaking? My code which contains the PUSH method is:
function get_elements() {
var divs = document.getElementsByTagName("div");
var htags = document.getElementsByTagName(TAB_HEADINGS);
sections = [];
tabs = [];
headings = []
for(var i=0; i<divs.length; i++) {
if(divs.className == SECTION_CLASS) sections.push(divs);
}
for(var i=0; i<htags.length; i++) {
if(htags.className == TAB_CLASS) {
var span = document.createElement("span");
span.innerHTML = htags.innerHTML;
tabs.push(span);
headings.push(htags);
}
}
};
so I guess my question is how do I combine the add on with the existing code to make it work?
Any help would be greatly appreciated...
Thanks
I understand that the javascript in IE5 doesn't support the PUSH() method of arrays, and have been researching and discovered that you need the add on:
if (typeof Array.prototype.push == "undefined") {
Array.prototype.push = function(str) {
this[this.length] = str;
}
}
however, does this need tweaking? My code which contains the PUSH method is:
function get_elements() {
var divs = document.getElementsByTagName("div");
var htags = document.getElementsByTagName(TAB_HEADINGS);
sections = [];
tabs = [];
headings = []
for(var i=0; i<divs.length; i++) {
if(divs.className == SECTION_CLASS) sections.push(divs);
}
for(var i=0; i<htags.length; i++) {
if(htags.className == TAB_CLASS) {
var span = document.createElement("span");
span.innerHTML = htags.innerHTML;
tabs.push(span);
headings.push(htags);
}
}
};
so I guess my question is how do I combine the add on with the existing code to make it work?
Any help would be greatly appreciated...
Thanks