Thanks for the feedback. I did try the altered
for syntax and fixed the typo. Still get an object expected error on IE and nothin' on FF.
However, in the interim I figured out a fix that does nothing for my knowledge regarding how to close all open divs in a cross-browser way. Since my issue was I didn't really know what div had been opened recently, I decided to approach the problem from that direction.
I created a hidden element on the page and prefilled it with the id for the default open div.
-
<input type="hidden" name="displayItem" id="displayItem" value="defaultDiv">
-
Then I wrote this function:
-
function swapDivs(sDiv) {
-
var oDiv = document.getElementById('displayItem').value
-
-
document.getElementById(oDiv).style.display = 'none';
-
document.getElementById(sDiv).style.display = 'inline';
-
document.getElementById('displayItem').value = sDiv
-
}
-
Worked pretty nifty, but I discovered that when I refreshed the page the last requested div displayed along with the defaultDiv, so I added this to the onUnload event of the page:
-
<body onUnload = "document.getElementById('displayItem').value = 'defaultDiv';">
-
I seem to be set, in terms of being able to move forward. However, I am still curious as to how one might close all open divs in a cross-browser way. If anyone is still willing to guide me, I'd be very pleased to try out your suggestions.
Thanks again.