struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: [OT] Javascript in HTML events
Date Sat, 11 Mar 2006 12:47:53 GMT
Yes but you have to create an object and assign it to your "aaa" var first,
before assigning a variable value such as "bbb"

Try
      var aaa = {};

Niall

----- Original Message ----- 
From: "Michael Jouravlev" <jmikus@gmail.com>
Sent: Saturday, March 11, 2006 8:34 AM


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


Mime
View raw message