Hi, I have got some javascript that toggles between two divs to hide and show each. The only problem is that it shows up an error.
here is the javascript and error message:
JS
[CODE] function switch1(div)
{
if (document.getElementById(‘one’))
{
var option=[‘one’,’two’,’three’];
for(var i=0; i<option.length; i++)
{ obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? “block” : “none”; }
}
}
HTML
[CODE] <div id=”one”><ul>
<li><h2><?php _e(‘Categories’); ?></h2></li>
<ul>
<?php wp_list_cats(‘sort_column=name&optioncount=1’); ?>
</ul>
</ul>
</div>
<div id=”two”>
<ul>
<li><h2><?php _e(‘Archives’); ?></h2>
<ul>
<?php wp_get_archives(‘type=monthly’); ?>
</ul>
</li>
</ul>
</div>
</div>
and then the error message:
[COLOR=”Red”]Obj has no properties
and it effects the line:
[COLOR=”Red”]
obj.style.display=(option==div)? “block” : “none”; }
If you could help it would be great!
Ricky