PDA

View Full Version : hide/show div



kirkh34
12-20-2009, 07:29 PM
Hello, I'm trying to have a div be hidden on loading the page but when you click a link it will show the div... here's code I have but it doesn't show when you click the link...

<script type="text/javascript">
function show(){
document.getElementById(test).style.display="block";
}

</script>

<div id="test" style="display:none;">
<p>Some text</p>
</div>


<a href="#" onclick="show(); return false;">Show</a>

gusblake
12-20-2009, 07:52 PM
document.getElementById takes a string, so test should be in quotes.