Jump to content

show / hide


knowram

Recommended Posts

found this cool little peace of code to show and hide things.

<html>
<head>
<title>test</title>
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
</head>


<BODY>

<input type="checkbox" name="Sort_Office" value="yes" onclick="toggle_visibility('foo');" />
<div id="foo">This is foo</div>
<br>
<a href="#" onclick="toggle_visibility('foo2');">Click here to toggle visibility of element #foo</a>
<div id="foo2">This is foo2</div>
</body>
</html>

 

right now when you lode the page it is showing the info. I would like it to be the other way around. and someone help.

 

Thanks.

 

 

Link to comment
https://forums.phpfreaks.com/topic/55658-show-hide/
Share on other sites

;D

 

<html>
<head>
<title>test</title>
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>

<style type="text/css">
<!--
#foo{
display:none;
}
-->
</style>


</head>



<BODY>

<input type="checkbox" name="Sort_Office" value="yes" onclick="toggle_visibility('foo');" />
<div id="foo">This is foo</div>


<a href="#" onclick="toggle_visibility('foo2');">Click here to toggle visibility of element #foo[/url]
<div id="foo2">This is foo2</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/55658-show-hide/#findComment-275337
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.