Click to See Complete Forum and Search --> : Problem with Javascript and IE


sgazari
01-09-2007, 12:15 PM
I'm having a problem with one of the pages in my site, http://www.ventana-crc.com/scheduled+measurement+system+-+measures.aspx. When I open the page in either Safari or Firefox, and click on any of the links under the subhead "Sample SMS Assessment Battery", I can see the brief description on the right side of the page. However, when I open the same page in IE6, the brief description appear on for a few seconds before IE refreshes the page and it disappeared. Please advise how I could fix this. The javascript I'm using for this is:

function blocking(nr)
{
if (document.layers)
{
document.layers['QRS'].display = 'none';
document.layers['CRT'].display = 'none';
document.layers['DA'].display = 'none';
document.layers['DSST'].display = 'none';
document.layers['DV'].display = 'none';
document.layers['DWR'].display = 'none';
document.layers['STM'].display = 'none';
document.layers['CFF'].display = 'none';
document.layers['BP'].display = 'none';
current = (document.layers[nr].display == 'none') ? 'block' : 'none';
document.layers[nr].display = current;
}
else if (document.getElementById)
{
document.getElementById('QRS').style.display = 'none';
document.getElementById('CRT').style.display = 'none';
document.getElementById('DA').style.display = 'none';
document.getElementById('DSST').style.display = 'none';
document.getElementById('DV').style.display = 'none';
document.getElementById('DWR').style.display = 'none';
document.getElementById('STM').style.display = 'none';
document.getElementById('CFF').style.display = 'none';
document.getElementById('BP').style.display = 'none';
vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
document.getElementById(nr).style.display = vista;
}
}

forty2
01-09-2007, 12:52 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>New Document</title>
<style type="text/css">
#first, #second, #three {
display: none;
}
</style>
<script type="text/javascript">
var old=null;
function ShowHide(curently) {
if (curently!=old) {
var obj=document.getElementById(curently);

(old!=null) ? document.getElementById(old).style.display='none' : null;

obj.style.display='block';
old=curently;
}
return false;
}
</script>
</head>
<body>
<a href="#" onclick="ShowHide('first')">first</a>
<a href="#" onclick="ShowHide('second')">second</a>
<a href="#" onclick="ShowHide('three')">three</a>
<div id="container">
<div id="first">text goes here first</div>
<div id="second">text goes here second</div>
<div id="three">text goes here three</div>
</div>
</body>
</html>

sgazari
01-09-2007, 01:55 PM
Thanks for the help. :)