473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

whats wrong here?

can anybody tell me what is wrong here, I got this shockwave test from
javascript in easy steps but it doesnt open the pages required

<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.html" ;
else
window.location = "index.html" ;
</script>
</head>
<body>
</body>
</html>

the index01 has a flash content, the index doesnt

TIA
Jul 20 '05 #1
9 1838
iz0nlee wrote on 12 jul 2003 in comp.lang.javascript:
can anybody tell me what is wrong here, I got this shockwave test from
javascript in easy steps but it doesnt open the pages required

<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" ] )
4 '(' and 5 ')'
window.location = "index01.html" ;
[I think no ';' here]
else
window.location = "index.html" ;
</script>
</head>
<body>
</body>
</html>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
thanks for the prompt reply,
I am not quite sure what this means

4 '(' and 5 ')'

I tried removing the semicolon from the first url but it didnt work.

I am running winXP and IE6, if that makes a difference.
when I click the 'index02.htm' file it just brings that blamk page up
instead of redirecting to index01.htm as it should.
thanks again though
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
iz0nlee wrote on 12 jul 2003 in comp.lang.javascript:
can anybody tell me what is wrong here, I got this shockwave test from
javascript in easy steps but it doesnt open the pages required

<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" ] )


4 '(' and 5 ')'
window.location = "index01.html" ;


[I think no ';' here]
else
window.location = "index.html" ;
</script>
</head>
<body>
</body>
</html>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 20 '05 #3
In article <Xn********************@194.109.133.29>, Evertjan.
<ex**************@interxnl.net> writes
iz0nlee wrote on 12 jul 2003 in comp.lang.javascript:

<snip>
window.location = "index01.html" ;


[I think no ';' here]

<snip>

The semicolon is perfectly respectable here. Remember that complicated
statements are built from simpler statements, and that some kinds of
statement can (must in C, C++, Java) end in a semicolon.

If a semicolon looks strange think of it as being inside its statement,
not as separate punctuation outside.

John
--
John Harris
mailto:jo**@jgharris.demon.co.uk
Jul 20 '05 #4
John G Harris wrote on 12 jul 2003 in comp.lang.javascript:
In article <Xn********************@194.109.133.29>, Evertjan.
<ex**************@interxnl.net> writes
iz0nlee wrote on 12 jul 2003 in comp.lang.javascript:

<snip>
window.location = "index01.html" ;


[I think no ';' here]

<snip>

The semicolon is perfectly respectable here. Remember that complicated
statements are built from simpler statements, and that some kinds of
statement can (must in C, C++, Java) end in a semicolon.

If a semicolon looks strange think of it as being inside its statement,
not as separate punctuation outside.


You are right, of cource, John.

if(condition)
statementtrue;
else
statementfalse;
statementalways;

The problem in my mind was, that without {} only one statement is
allowed.

I think it was Pascal syntax that disallowed a ; in that position
otherwise the "else" was orphaned ?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #5
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>

I'm sure there must be a simple explanation, perhaps its something to do
with the 'pipe' characters, I'm not sure what they do, but for the time
being I might just put the flash pages up for now as most people use
shockwave capable browsers anyway and my site doesnt get hits in the
millions exactly so it probably wont matter.
Thanks for all your suggestions and interest
regards
Jul 20 '05 #6
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)
Jul 20 '05 #7
I did just what you said and found when I put the Netscape part in it
failed.
I re wrote it like this and it works though I dont have netscape to test it,
(nor Mac or win3.1 for that matter)
I'm happy it works now though and thanks for all your help.
I'll put the script in the head of index.htm then it should transfer most
people to index01

regards
p.s. I answered this a few minutes ago but sent it 'reply' instead of
'reply group' by accident. Sorry

<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 ["Shockwave Flash"]
|| navigator.plugins ["Shockwave Flash 2.0"]
)
window.location = "index01.htm";
else
window.location = "index.htm";
</script>
</head>
<body>
failed again
</body>
</html>
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
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)

Jul 20 '05 #8
iz0nlee wrote on 13 jul 2003 in comp.lang.javascript:
I'll put the script in the head of index.htm then it
should transfer most people to index01
[........]
else
window.location = "index.htm";


The others will keep reloading index.htm again and again ??????????
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #9
iz0nlee wrote on 13 jul 2003 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
iz0nlee wrote on 13 jul 2003 in comp.lang.javascript:
> I'll put the script in the head of index.htm then it
> should transfer most people to index01
> [........]
> else
> window.location = "index.htm";


The others will keep reloading index.htm again and again ??????????

oops, didnt think of that, i will put it in a separate file , index, and
call the pages index01 and index02.
thanks for a timely rescue
regards


Or just delete thes two scriptlines:

else
window.location = "index.htm";

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."',...
1
by: Matthew Wilson | last post by:
I need to write a function crc(msg, len) that gets a char array of length len and then calculates the crc32 for the code. I don't understand what's going wrong in the code I have. It goes...
5
by: kernel.lover | last post by:
hello, I want to know if a fuction say malloc is declared as void *malloc() then whats the significance of void here. Does void * is used when function has the flexibility to return any type of...
3
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');"...
4
by: blah | last post by:
Hello everyone, Ive been trying to get my application to "click" on a button in another application using SendMessage, Ive gotten this far but Im not sure whats wrong with this code, here is the...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
1
by: Abubakar | last post by:
Hi, In my application, Some of my thread gets stuck somewhere. The vs2k5 debugging "Thread" window shows that stuck thread and I can I dentify it. In its Name column the following text is...
4
by: LoneHunter01 | last post by:
Basically, I just need a general direction on where to go for this. Yes, this is for a school project, though it's strictly an optional one (and I have tried many solutions, one in-depth). We've...
5
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.