Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Regular Coder Nischumacher's Avatar
    Join Date
    Oct 2005
    Location
    Bombay, India
    Posts
    196
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •