• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript syntax error

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic