1 July 2011

Html show hide button

I've set up a new blog where i can post my MSc project user entry system on there. At the moment i have a long way to go. Any way at the moment i have a couple of buttons that are meant to display information on line of code but you can't hide it so i remembered xkcd had the spoiler hide show code but it looked a bit complicated so i searched elsewhere and found this website and it looked amazing and from these two i developed my own version of hide and show tailored to my specs.

<!--my code for info button-->
<button type="button" onclick="if (document.getElementById('PartitionSource Info').style.display !=''){
document.getElementById('PartitionSource Info').style.display='';
document.getElementById('PartitionSource Info').innerHTML='infomation based on button';
}
else{
document.getElementById('PartitionSource Info').style.display='none';
}">
Info
</button>
<p id="PartitionSource Info" style="display: none">
text</p>

And here is the actual button


No comments:

Post a Comment