...

View Full Version : Expanding and Collapsing drop down not working in Fire Fox, Ok in IE



Jerjberker
11-08-2009, 11:33 PM
Hi

This code works in IE, but not in FF. Any idea why. The URL is www.berkersdogbeds.com. Try clicking on either the down arrows next to about our beds. In IE it work, but not in FF?

<SCRIPT type=text/javascript>

function expandCollapse(elem, changeImage) {
if (document.getElementById) {
ecBlock = document.getElementById(elem);
if (ecBlock != undefined && ecBlock != null) {
if (changeImage) {
//gets the image associated
elemImage = document.getElementById(elem + "Image");
}
//make sure elemImage is good
if (!changeImage || (elemImage != undefined && elemImage != null)) {
if (ecBlock.currentStyle.display == "none" || ecBlock.currentStyle.display == null || ecBlock.currentStyle.display == "") {
//shows the info.
ecBlock.style.display = "block";
if (changeImage) {
//Just got in expanded mode. Thus, change image to "collapse"
elemImage.src = "/assets/images/up.png";
}
}
else if (ecBlock.currentStyle.display == "block") {
//hide info
ecBlock.style.display = "none";
if (changeImage) {
//Just got in collapsed mode. Thus, change image to "expand"
elemImage.src = "/assets/images/down.png";
}
}
else {
//catch any weird circumstances.
ecBlock.style.display = "block";
if (changeImage) {
elemImage.src = "/assets/images/up.png";
}
}
}
//end check elemImage
}
//end check ecBlock
}
//end getElemById
}
//end expandCollapse function

</SCRIPT>

Nischumacher
11-09-2009, 07:54 AM
use 'ecBlock.style.display' instead of 'ecBlock.currentStyle.display'...



function expandCollapse(elem, changeImage) {
if (document.getElementById) {
ecBlock = document.getElementById(elem);
if (ecBlock != undefined && ecBlock != null) {
if (changeImage) {
//gets the image associated
elemImage = document.getElementById(elem + "Image");
}
//make sure elemImage is good
if (!changeImage || (elemImage != undefined && elemImage != null)) {
if (ecBlock.style.display == "none" || ecBlock.style.display == null || ecBlock.style.display == "") {
//shows the info.
ecBlock.style.display = "block";
if (changeImage) {
//Just got in expanded mode. Thus, change image to "collapse"
elemImage.src = "/assets/images/up.png";
}
}
else if (ecBlock.style.display == "block") {
//hide info
ecBlock.style.display = "none";
if (changeImage) {
//Just got in collapsed mode. Thus, change image to "expand"
elemImage.src = "/assets/images/down.png";
}
}
else {
//catch any weird circumstances.
ecBlock.style.display = "block";
if (changeImage) {
elemImage.src = "/assets/images/up.png";
}
}
}
//end check elemImage
}
//end check ecBlock
}
//end getElemById
}
//end expandCollapse function



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum