I'm having a problem with getElementbyId as follows:
<script type="text/javascript">
<!--
function show_links(locale) {
var box = document.getElementById(locale);
if(box.style.display == "none") {
box.style.display = "inline";
}
else {
box.style.display = "none";
}
}
//-->
</script>
<div class="link"><strong><a href="javascript:show_links(test);">Test</a></strong></div>
<div class="test"> Blah blah blah. This content comes and goes. </div>
So there you have the code. When I click the link "Test", it should hide the "blah blah blah text". When clicked again, it should show. However, I have an odd problem. I processed the code through a debugger, and it seems that the line var box = document.getElementById(locale);
is not working correctly. box
is being set to null. Can anyone theorize why?