Click to See Complete Forum and Search --> : Simple if else question...


ben456
12-17-2002, 05:04 PM
I know this is a really basic question but how do I change the following code to stay on this page if the browser is IE instead of going to ieindex.htm?

The reason for this is that I want to use a marquee tag and I can't find a script that works in IE and Netscape that moves with the rest of the page when the browser is resized. ANy suggestions greatfully received

Thanks in anticipation,
Ben

<script language="JavaScript">
<!--
function redirect()
{
if (navigator.appName=='Netscape')
window.location.href='nsindex.htm';
else
{ window.location.href='ieindex.htm'; }
}
-->
</script>
</head>

<body onload="redirect()" >
</body>

swon
12-17-2002, 05:11 PM
<script language="JavaScript">
<!--
function redirect()
{
if (navigator.appName=='Netscape')
window.location.href='nsindex.htm';
else
{ } // leave the else{} empty
}
//-->
</script>
</head>

<body onload="redirect()" >
</body>

ben456
12-17-2002, 05:22 PM
Thanks, that's done the trick!

Ben

pyro
12-17-2002, 05:57 PM
Just for the recored...You don't need the else {} at the bottom. Your script should work fine without it.