• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP & JavaScript Problem

 
Bhushan Shete
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am invoking JavaScript from a JSP. I am passing a string value from a JSP variable to the JavaScript function. If this string contains a ' (single quote), then the JavaScript fails.
eg: When I call the function as follows => (the variable remarks contains a single quote in that string.)
onClick="openWin('<%= remarks %>')"
I have also tried the following =>
onClick=openWin("<%= remarks %>")
onClick=openWin(\"<%= remarks %>\")
Pls. help. Is there any way out & I can get rid of this ???
 
Arunagiri, Shanmugham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try using the code below,
onclick=open("+<%= remarks %>+")..
and see if it help u.
Arun
 
Bhushan Shete
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arunagiri, Shanmugham:
Hi,
Try using the code below,
onclick=open("+<%= remarks %>+")..
and see if it help u.
Arun


Thanx for ur reply. I have tried it. Actually, this statement is in a JSP & not inside a println statement, so it doesn't work. This JavaScript function is called form "<a href= " tag.
Anyway, thanx for ur reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic