You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Jouravlev <jm...@gmail.com> on 2006/03/11 23:45:45 UTC
Re: [OT] Javascript in HTML events - RESOLVED
Resolved. Sorry to type the question before searching thoroughly. For
POST request I had to set content-type header:
ajaxRequest.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
Michael.
On 3/11/06, Michael Jouravlev <jm...@gmail.com> wrote:
> I am cleaning up my Javascript code. First I made all functions having
> prefix, so they won't mix with others' functions. Then I noticed that
> DOJO uses one global variable dojo, and defines everything including
> functions inside it. I thought that was cool, and tried it myself, but
> it does not work.
>
> This works:
>
>
> <html>
> <head>
> <script language="javascript">
> var aaa;
>
> aaa = function (frm) {
> alert("Hi!");
> };
> </script>
> </head>
>
> <form method="post" action="qq2.html" onsubmit="return aaa (this);">
> <input type="submit" />
> </form>
> </html>
>
>
> This does not work (function is not called):
>
>
> <html>
> <head>
> <script language="javascript">
> var aaa;
>
> aaa.bbb = function (frm) {
> alert("Hi!");
> };
> </script>
> </head>
>
> <form method="post" action="qq2.html" onsubmit="return aaa.bbb (this);">
> <input type="submit" />
> </form>
> </html>
>
>
> I was thinking of having one global object "aaa" and stick all my
> functions inside it. Is it possible? Or HTML does not allow to call
> expressions with dots in it?
>
> Michael.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org