wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 60785
    
  65

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.:-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript syntax error
 
Similar Threads
//comments
use regular expression to check date format in javascript
Replace text by HTML links
JSP, JavaBean Coding with JavaScript
Mixing JSP and Scriptlets throws compilation errors