For a hobby site, I found this script and I'd like it to work the other way
around. The content has to show and the visitor has to click to hide it.
Could someone help me please? I'm a total Java-newbie...
TIA
Jaap
Here's the code:
in <head>tag
<script type="text/javascript">
<!--
var storedDiv = null;
function getDiv(oID) {
if(document.get ElementById) {
return document.getEle mentById(oID);
} else if( document.all ) {
return document.all[oID];
} else { return null; }
}
window.onload = function () {
for( var i = 0, y; y = getDiv('ans'+i) ; i++ ) {
y.style.display = 'none';
}
};
function toggleInfo(oID) {
var oDiv = getDiv(oID); if( !oDiv ) { return; }
oDiv.style.disp lay = (oDiv.style.dis play=='none') ? 'block' : 'none';
if( storedDiv && storedDiv != oDiv ) { storedDiv.style .display = 'none';
} storedDiv = oDiv;
}
//--></script>
in <body>tag
<span style="cursor:h and; cursor:pointer" onclick="toggle Info('ans0');">
Hide/show content
</span><br><br>
<div id="ans0">
content
</div>