Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-08-2009, 11:33 PM   PM User | #1
Jerjberker
New to the CF scene

 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Jerjberker is an unknown quantity at this point
Expanding and Collapsing drop down not working in Fire Fox, Ok in IE

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>
Jerjberker is offline   Reply With Quote
Old 11-09-2009, 07:54 AM   PM User | #2
Nischumacher
Regular Coder

 
Nischumacher's Avatar
 
Join Date: Oct 2005
Location: Bombay, India
Posts: 196
Thanks: 0
Thanked 2 Times in 2 Posts
Nischumacher has a little shameless behaviour in the past
use 'ecBlock.style.display' instead of 'ecBlock.currentStyle.display'...

Code:
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
__________________
- NS 666
.net DEVILoper
Nischumacher is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:06 AM.


Advertisement
Log in to turn off these ads.