Gossamer Forum
Home : Products : DBMan : Customization :

Syntax Error....

Quote Reply
Syntax Error....
Keep getting the following error on a Javascript Function:

browserName = navigator.appName; // detect browser
browserVer = parseInt(navigator.appVersion);
if ((browserName == "Netscape") | | (browserVer >= 3)) {
version = "n3";
}
else {
version = "n2";
}
if (version == "n3")

And this is the error I'm receiving:

Reason: syntax error at ./king.pl line 156, near ")) " (Might be a runaway multi-line | | string starting on line 104) syntax error at ./king.pl line 159, near "else"


Any help would be appreciated.

Thanks
Fred
Quote Reply
Re: Syntax Error.... In reply to
Do you have your Javascript function within a print qq| statement?

------------------
JPD





Quote Reply
Re: Syntax Error.... In reply to
Yes it's in print qq statement
Quote Reply
Re: Syntax Error.... In reply to
Hiya Fred,

That's because the pipe symbols in your JavaScript function are closing the print qq statement. The simplest way around it is to use another symbol for the print qq. Try using the tilde:

Code:
print qq~
HTML goes here
~;

Or, if for some weird reson you HAVE to use the pipe, make sure you escape it with a backslash:

Code:
if ((browserName == "Netscape") \|\| (browserVer >= 3)) {

tata,
adam
Quote Reply
Re: Syntax Error.... In reply to
\|\| works. Thanks

Fred