File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

javascript syntax error

Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510


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

Joined: Jan 10, 2002
Posts: 63866

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] [About Bear] [Books by Bear]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
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.

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.:-)
I agree. Here's the link:
subject: javascript syntax error
It's not a secret anymore!