Web Analytics Made Easy -
StatCounter Javascript Code: Show/Hide Help Needed - CodingForum

Announcement

Collapse
No announcement yet.

Javascript Code: Show/Hide Help Needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript Code: Show/Hide Help Needed

    I have a show/hide script, I need help because I want to make it so that when you click show it stays showing instead of it being mouseover, and when you load the page I want it to be rehidden, I also want it possible to hide it onclick. If anyone can help Id appriciate it.

    There is a sample here http://www.victoryinhim.com/vic/answers/ on the right hand side.
    Code:
    <script>
    function toggle(theDiv) {
        var elem = document.getElementById(theDiv);
        elem.style.display = (elem.style.display == "none")?"":"none";
    }
    //-->
    </script>
    </head>
    <body>
    
     <div id="test" onMouseOver="toggle('testLayer1');return false;"
    onMouseOut="toggle('testLayer1');return false;">
      <a href="#">Show All</a>
      <div id="testLayer1" style="display: none;">
    <u>A-C</u><BR>
    <a href="/vic/answers/A-C/answers/a/ab.html">Abbiding in Christ</a> <BR> 
    <a href="/vic/answers/A-C/answers/a/ac.html">Abundance</a><BR>
    <a href="/vic/answers/A-C/answers/a/af.html">Afflictions</a><BR>
    <a href="/vic/answers/A-C/answers/a/an.html">Anger</a><BR>
    <a href="/vic/answers/A-C/answers/a/ans.html">Answered Prayer</a><BR>
    <a href="/vic/answers/A-C/answers/b/ba.html">Backsliding</a> <BR>
    <a href="/vic/answers/A-C/answers/b/be.html">Believers Preserved</a>
    <a href="/vic/answers/A-C/answers/b/ben.html">Benevolence</a><BR>
    <a href="/vic/answers/A-C/answers/b/bes.html">Be Still Before God</a><BR>
    <a href="/vic/answers/A-C/answers/c/cha.html">Chastisement</a> <BR>
    <a href="/vic/answers/A-C/answers/c/cheer.html">Cheerfulness</a><BR>
    <a href="/vic/answers/A-C/answers/c/chris.html">Chritian Duty</a><BR>
    <a href="/vic/answers/A-C/answers/c/chrism.html">Christs Love</a> <BR>
    <a href="/vic/answers/A-C/answers/c/chrit.html">Christ's Majesty</a> <BR>
    <a href="/vic/answers/A-C/answers/c/confe.html">Confessing Christ</a><BR>
    <a href="/vic/answers/A-C/answers/c/conte.html">Contentment</a> <BR>
    <a href="/vic/answers/A-C/answers/c/cou.html">Courage</a> 
    </div>
    Last edited by Internet_Rules; Jul 31, 2005, 04:37 PM.

  • #2
    Code:
    <div id="test" onclick="toggle('testLayer1');return false;">
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

    Comment


    • #3
      Except you cant click on ANY of the links now, it just hides it when I click on any of the links.

      http://www.victoryinhim.com/vic/answers/

      It has the added code in it now..
      Last edited by Internet_Rules; Aug 1, 2005, 07:55 PM.

      Comment


      • #4
        Can anyone help?

        Comment


        • #5
          Move the onclick to the "show all" link. BTW, your markup needs a lot of work.
          Last edited by hemebond; Aug 1, 2005, 08:12 PM.
          Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
          I code to specs, and test only in Firefox (unless stated otherwise).

          Comment


          • #6
            huh? I dont have an onclick function in the script...

            Comment


            • #7
              Code:
              <div id="test" onclick="toggle('testLayer1');return false;">
                <a href="#">Show All</a>
              change to
              Code:
              <div id="test"><a onclick="toggle('testLayer1');return false;">Show All</a>
              Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
              I code to specs, and test only in Firefox (unless stated otherwise).

              Comment


              • #8
                Alright it works thank you.

                Comment

                Working...
                X