Hi everyone,
I’m trying to write code that will display no text (except a link) and then make text appear when a link is clicked. So far I’ve only managed to write code that loads a page with text and hides the text when a link is clicked. Does anyone know how to edit the code below to make it work as I wish?
Thanks,
Stu
In the header:
<script language="JavaScript1.1">
var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId);
if (lText == 'Show details') { link.innerHTML = 'Hide details'; d.style.display = 'block'; }
else { link.innerHTML = 'Show details'; d.style.display = 'none'; } }
</script>
In the body:
<a title="show/hide" alt='show/hide' id="exps112_link" href="javascript: void(0);" style="text-decoration: none;" onclick="toggle(this, 'exps132');">Hide details</a>
<div id="exps132" style="padding: 0px;" >
TEXT TO SHOW/HIDE GOES HERE
</div>