iz0nlee wrote on 13 jul 2003 in comp.lang.javascript
:
Thanks to all of you who have commented, I found the errant '(' and
script is now as below and I've checked it till I'm blue in the face
but it still only returns its own page and doesnt jump to the
'index01'page as it should (I think)
<html>
<head>
<script type = "text/javascript">
if ( (navigator.appName == "Microsoft Internet Explorer"
&& navigator.appVersion.IndexOf ( "Mac" ) == -1
&& navigator.appVersion.IndexOf ( "3.1" ) == -1)
||
(navigator.plugins
&& navigator.plugins[ "Shockwave Flash" ] )
||
navigator.plugins [ "Shockwave Flash 2.0" ] )
window.location = "index01.htm";
else
window.location = "index.htm" ;
</script>
</head>
<body>
failed again
</body>
</html>
Now start testing by deviding the problem, make three seperate testfiles
and execute them in the same directory as your present html-file:
============ test1.html ====================
<script type = "text/javascript">
if ( true )
window.location = "index01.htm";
else
window.location = "index.htm" ;
</script>
============ test2.html ====================
<script type = "text/javascript">
if ( false )
window.location = "index01.htm";
else
window.location = "index.htm" ;
</script>
============ test3.html ====================
<script type = "text/javascript">
result =(navigator.appName == "Microsoft Internet Explorer"
&& navigator.appVersion.IndexOf ( "Mac" ) == -1
&& navigator.appVersion.IndexOf ( "3.1" ) == -1)
||
(navigator.plugins
&& navigator.plugins[ "Shockwave Flash" ] )
||
navigator.plugins [ "Shockwave Flash 2.0" ] )
alert(result) // must be true or false
</script>
===============================================
And let us hear the results.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)