SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Help!! toggle

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2012
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help!! toggle

    Hi everyone,

    Im trying to get this hide, show, gife image to work on multiple pages but it seems to be working only on the first page not on the other pages?

    here is my code:


    echo "<div id=\"headerDivImg\" class=\"displayTitle\">$title_txt<a id=\"imageDivLink\" href=\"javascript:toggleDiv('contentDivImg', 'imageDivLink');\"><img src=\"../img/minus-2.png\"></a> </div> ";
    echo "<div class='maintitles_jd' id='contentDivImg' style='display:block;' >"; //job description content

    <script type="text/javascript">
    function toggleDiv(showHideDiv, switchImgTag) {
    var ele = document.getElementById(showHideDiv);
    var imageEle = document.getElementById(switchImgTag);

    if(ele.style.display == "block") {
    ele.style.display = "none";
    imageEle.innerHTML = '<img src="../img/plus-2.png">';
    }
    else {
    ele.style.display = "block";
    imageEle.innerHTML = '<img src="../img/minus-2.png">';
    }

    }
    </script>

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,088
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Could you post a link to a page where the code works and a second link to a page where it doesn't.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2012
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What im trying to do is - is it possible to have multiple ID toggle?

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,088
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Yes, that should be possible, but I still haven't really grasped what you are trying to do.


Bookmarks

Posting Permissions

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