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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    51° 03' -78" N -114° 05' 72" W
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    visibility not showing

    Hello all I am having trouble getting my div id box to show and hide here is the code

    Code:
    <a href="#" onclick="hideshow('search')">Search</a>
    Code:
    <script language="JavaScript">
    	function hideshow(me){
    		if (me.style.visibility=="hidden"){
    			me.style.visibility="visible";
    			}
    		else {
    			me.style.visibility="hidden";
    			}
    		}
    </script>
    <div id="search" class="tstyle">
    <form method="GET" action="http://www.google.com/search">
    	<input type=hidden name=ie value=UTF-8>
    	<input type=hidden name=oe value=UTF-8>
    	<input type=text name=q style="width:120px" maxlength=255 value="Google Search">
    	<input type="submit" name="btnG" value="Search">
    	<input type="hidden" name=domains value="lycosidea.com">
        <br />
        <input type="radio" name="sitesearch" value="">WWW
    	<input type="radio" name="sitesearch" value="lycosidea.com" checked>Pod-Tours
    </form>
    </div>

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,603
    Thanks
    0
    Thanked 645 Times in 635 Posts
    <script language="JavaScript">
    function hideshow(me){
    if (document.getElementById(me).style.visibility=="hidden"){
    document.getElementById(me).style.visibility="visible";
    }
    else {
    document.getElementById(me).style.visibility="hidden";
    }
    }
    </script>
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    51° 03' -78" N -114° 05' 72" W
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thankyou!

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or a little bit shorter:

    Code:
    function hideshow(me){
       getId(me).style.display=(getId(me).style.display=="none"))?"block":"none";
    }
    function getId(id){
       return document.getElementById(id)
    }

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    51° 03' -78" N -114° 05' 72" W
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cool Thanks


  •  

    Posting Permissions

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