0

Hi frnds,

I m using the below code...it is working fine...nothing prob in it..

just i want change the visibility of that div....here by default div is visible...but i want default div should be hidden.....plz look into the below code..

<html>
<head>
 
    <script language="javascript" type="text/javascript">
    function showHideDiv()
    {
        var divstyle = new String();
        divstyle = document.getElementById("div1").style.visibility;
        if(divstyle.toLowerCase()=="visible" || divstyle == "")
        {
            document.getElementById("div1").style.visibility = "hidden";
        }
        else
        {
            document.getElementById("div1").style.visibility = "visible";
        }
    }
    </script>   
</head>

<body>

    <div id="div1" class="divStyle">
        Show Hide Div 
    </div>
    
    <center>
      <a href="#" onclick="showHideDiv()" >Click Here</a>
    </center>
	
	
    
</body>
</html>
4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

Either set the styles in the css for 'divStyle'
like

<STYLE>
...
...
. divStyle{
     ...
     ...	
     visibility:hidden;    
     ...
     ...
}
....
</STYLE>

Or you can set it in the style attribute of the div element as

<div id="div1" class="divStyle" style="visibility:hidden;">

hope this helps

0
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<div id='imageSpace'><img src='images/image.jpg'></div>
<input type="radio" name="changer" value="show" onclick="document.getElementById('imagespace').style.display = '';"> Show<br>
<input type="radio" name="changer" value="hide" onclick="document.getElementById('imagespace').style.display = 'none';"> Hide
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.