aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes javascript syntax error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript syntax error" Watch "javascript syntax error" New topic
Author

javascript syntax error

Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

Hi,

I can't figure out a syntax error in a javascript expression wich is used inside a jsp page.

the expression is :


changeList is a javascript function.
I had to escape the ' character .otherwise the code doesn't work.
if i remove the \' then i don't get error but nothing happen . if i add the \' it works but a syntax error is raised.

what could be the problem?

thanks for helping.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Just adding characters when something doesn't work isn't likely to help much. The escaping of the quotes is most certainly not necessary. If the code isn't working it's time to try debugging the code.

To start, what are you trying to pass to the function. Four strings?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
well you do not need javascript: with an event handler. That will not cause the error.

Do yourself a favor and download Mozilla or Firefox and use its JavaScript debugger.


Eric
Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
you do not need to escape the single quotes inside of double quotes. Escape characters are required only if you have single quotes inside single quotes or double quotes inside double quotes.
Where is the error coming? In the call to the function or somewhere inside the function.. put alert messages to figure out.


Life called,so here I am.<br />Cheers<br />Niki.:-)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javascript syntax error