Mozilla has a JavaScript debugger that is very very useful for stepping
through the code to see where the error crops up. Worth downloading and
learning to use. Has saved many hours time for me I can say!

(alerts() are still very useful though. Espcially for bugs that only come up
in IE!)

-----Original Message-----
From: Mark Lowe [mailto:[EMAIL PROTECTED]
Sent: Thursday, 26 February 2004 18:58
To: Struts Users Mailing List
Subject: Re: JavaScript Parameter



First when debuging javascript alert boxes are handy.

alert(this.form,'<%= val %>')

or

alert(this.form,'<c:out value="${val}" />')

or on tc 5

alert(this.form,'${val}')

if that does what you want start debuging the functions by using alert
boxes.

function myfunction(form,val) {
        alert(form.name);
        alert(val);
}

onclick="myfunction(this.form,'<%= val %>')"

if you use double quotes like you seem to be you may have to escape
them, generally easier to use ' rather than " when calling functions in
the html (in the actual script I prefer to stick to " as more
readable).

and so on. You should get to the bottom of your problem soon enough.

On 26 Feb 2004, at 05:32, Anirudh Jayanth wrote:

> Hi,
> I have a scriptlet
> <% String val=obj.getValue("Key"); %>
> I need to use this value to be passed as a javascript parameter inorder
> to set a property value.
>
> <html:image pageKey=".." altKey=".."
> onclick="jsFunction(form,"<%=val%>")" />
> The parameter value is not being passed to jsFunction
>
> This works when I use a hardcoded value
> <html:image pageKey=".." altKey=".."  onclick="jsFunction(form,"1234")"
> />
>
> I have tried these variations aswell
> <html:image pageKey=".." altKey=".."
> onclick="jsFunction(form,<%=val%>)" />
> <html:image pageKey=".." altKey=".."
> onclick="jsFunction(form,'<%=val%>')" />
>
> Cud somebody please tell me the correct way to do this.
> Regards,
> Anirudh
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



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

Reply via email to