This code posted does NOT work for me. I have been trying countless hours now to be able to toggle a div. Of course it works perfectly in FireFox.
This is my code:
function togglediv(divid)
{
if(document.getElementById(divid).style.visibility == ‘hidden’)
{
document.getElementById(divid).style.visibility = ‘visible’;
}
else
{
document.getElementById(divid).style.visibility = ‘hidden’;
}
}
All this is in the <head> tag.
Then in the body I have this:
<? $user_agent = isset($_SERVER[‘HTTP_USER_AGENT’]) ? $
if(strpos($user_agent, ‘MSIE’) !== false)
{
echo “<input type=”button” value=”Show Hide Comments (“,$totalComments,”)”onClick=”javascript:toggle(‘comments’)” style=”margin: 0px 585px 50px 0px;” />”;
}
Which dispalys as:
<input type=”button” value=”Show Hide Comments (2)”onClick=”javascript:togglediv(‘comments’);” style=”margin: 0px 585px 50px 0px;” />
If you view source. It works fine in FireFox, can anyone help me make this work?
Thanks,
Shane