2011-04-02, 01:48 PM
Hey,
I'm trying to add a 'dropdown' menu to my first theme. However I'm struggling to find a javascript code that will work.
My friend gave me this but I can't get it working:
Does anyone see what needs to be done to fix it?
It will need to be backwards compatible so if javascript isn't enabled the div will automatically display.
Cheers,
Clarkie
I'm trying to add a 'dropdown' menu to my first theme. However I'm struggling to find a javascript code that will work.
My friend gave me this but I can't get it working:
<a href="#" onclick="document.getElementById('myDiv').style.display='visible'>Click to show the div</a>
<script type='text/javascript'>
function atload() {
}
window.onload=atload;
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('myDiv').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.myDiv.visibility = 'hidden';
}
else { // IE 4
document.all.myDiv.style.visibility = 'hidden';
}
}
</script>
Does anyone see what needs to be done to fix it?
It will need to be backwards compatible so if javascript isn't enabled the div will automatically display.
Cheers,
Clarkie