Y
Yourself
I have the following simple Javascript:
<script language="JavaScript" type="text/JavaScript">
<!--
function ToggleVisibility(panelId) {
var pnl = document.getElementById(panelId);
alert(pnl.style.display);
if (pnl.style.display == 'none')
{
alert('going to set to block');
pnl.style.display = 'block';
alert('now set to block');
}
else
{
alert('going to set to none');
pnl.style.display = 'none';
alert('now set to none');
}
}
//-->
</script>
and I have this markup:
<a href="#" onclick="javascript:ToggleVisibility('testid');">Click Me</a>
<div id="testid" style="display:none;">
Hello
</div>
Now when I click the 'Click Me' link, the div toggles on and off fine in
Firefox.
However, in IE the div is never shown, despite the correct alerts being
fired (i.e. I get a 'none', 'going to set to block', 'now set to block'
message sequence).
WTF is going on??
<script language="JavaScript" type="text/JavaScript">
<!--
function ToggleVisibility(panelId) {
var pnl = document.getElementById(panelId);
alert(pnl.style.display);
if (pnl.style.display == 'none')
{
alert('going to set to block');
pnl.style.display = 'block';
alert('now set to block');
}
else
{
alert('going to set to none');
pnl.style.display = 'none';
alert('now set to none');
}
}
//-->
</script>
and I have this markup:
<a href="#" onclick="javascript:ToggleVisibility('testid');">Click Me</a>
<div id="testid" style="display:none;">
Hello
</div>
Now when I click the 'Click Me' link, the div toggles on and off fine in
Firefox.
However, in IE the div is never shown, despite the correct alerts being
fired (i.e. I get a 'none', 'going to set to block', 'now set to block'
message sequence).
WTF is going on??