Greetings, and thanks in advance for considering my problem.
I am working in a basic .htm page, in which I want to close all displayed DIVs with one event. In IE, I find that this works:
However, in Firefox it does not. Please forgive me for not starting with Firefox, I work in an all-IE environment and this is my first foray in some time into the real world of cross-browser coding.
So, I tried the following for cross-browser efficacy:
Now IE tells me an object is expected and FF does nothing at all, and I am clearly not clever enough to find my way. Any help you can provide would be very appreciated.
I am working in a basic .htm page, in which I want to close all displayed DIVs with one event. In IE, I find that this works:
Code:
function closeAll() {
var oDiv = new Enumerator(document.body.getElementsByTagName("DIV"));
for(oDiv.moveFirst(); !oDiv.atEnd(); oDiv.moveNext()) {
if (oDiv.item().style.display == 'inline') {
oDiv.item().style.display = 'none';
}
}
}
So, I tried the following for cross-browser efficacy:
Code:
function closeAll() {
var oDiv = document.getElementsByTagName("DIV");
for (var i = 0, i < oDiv.length; i++) {
if (oDiv[i].style.display == 'inline') {
oDiv[i].style.display = 'none';
}
}
}
Comment