Is the value of jsMessage a string with quotes around it? I'm assuming it's a string value, maybe it isn't, but if it is, you'll need quotes around it, and single quotes at that since its within a quoted event handler.

Did you look at the generated source to see if your expected value was output? Did you see any Javascript errors? (Firebug in Firefox is good for this). What happens when you tried it?

Frank

Chetan Pandey wrote:
Hi Puneet:

None of the suggestions worked.

I even tried "onclick =returnconfirmationMessage(<%=jsMessage%>)"

And other combinations with no help.

Thanks.

Chetan

-----Original Message-----
From: Puneet Lakhina [mailto:[EMAIL PROTECTED] Sent: Thursday, September 07, 2006 11:13 PM
To: Struts Users Mailing List
Subject: Re: Setting a Variable in Javascript Functions parameter

On 9/7/06, nirav bumia <[EMAIL PROTECTED]> wrote:
Just pass the variable jsMessage(remove the quotes)  i.e.
<html:link action="/delete" onclick="return
confirmationMessage(jsMessage)">
and use this variable in javascript.


I suppose you are trying to pass a variable that you have in some scope in
your jsp to your javascript function.

Am not really sure the above suggested solution will work. Reason being
there is no way for struts(or your jsp processor) to know if this is
variable isnt actually a javascript variable.

I would use something like this

<html:link action="/delete" onclick =
'<%="returnconfirmationMessage(jsMessage)" %>'

Try it and let us know what happens.

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to