struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "皮苗" <snoopy...@gmail.com>
Subject Re: Setting a Variable in Javascript Functions parameter
Date Fri, 08 Sep 2006 03:51:53 GMT
What if you replace the html:link tag with a anchor tag of the standard html
tags? Just for a try.

2006/9/8, Chetan Pandey <cpandey@bluesingapore.com>:
>
> Doing what you suggested results in a Confirm Box with Text =
> <%=jsMessage%>
>
> Is something wrong with my JS function.
>
> Here it is:
>
> <script type="text/javascript">
> function confirmationMessage(message)
> {
> var agree = confirm(message);
> if (agree)
>        return true ;
> else
>        return false ;
> }
>
> </script>
>
> -----Original Message-----
> From: 皮苗 [mailto:snoopy207@gmail.com]
> Sent: Friday, September 08, 2006 11:38 AM
> To: Struts Users Mailing List
> Subject: Re: Setting a Variable in Javascript Functions parameter
>
> Is jsMessage a java variable or a javascript variable? If it's a java
> variable and you want to pass its value to the javascript function, I
> think
> "onclick=return confirmationMessage('<%=jsMessage%>');" will work. The
> quotes inside the parentheses shouldn't be omitted.
>
>
> 2006/9/8, Chetan Pandey <cpandey@bluesingapore.com>:
> >
> > 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:puneet.lakhina@gmail.com]
> > 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 <bumia.nirav@gmail.com> 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.
> > --
> > Puneet
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message