[Javascript] Objects with Javascript

Felix bruno.lanciau at cnes.fr
Tue Jul 9 04:24:10 CDT 2002


Sorry, I cannot speak english very well, but see below

You cannot make a class directly.
to create an object you can write this
       my_Object = new one_kind_of_class(atribut1,atribut2,atribut3);

now, look at one_kind of class

      function one_kind_of_class(atribut1,atribut2,atribut3)
       {
        this.at1 = atribut1;
        this.at2 = atribut2;
        this.at3 = atribut3;

        this.method_one = firstMethod;
        this.method_two = secondMethod;
       }

The methods are functions declared outside the class body

      function firstMethod()
       {
        alert("I am the first method");
       }

      function secondMethod()
       {
        alert("I am the second method");
       }

Is it clear...?

Ask for more ...


CU+

 Félix
 bruno.lanciau at cnes.fr
----- Original Message -----
From: "Pramod Jain, INDENT" <pramod at indent.org>
To: <javascript at latech.edu>
Sent: Wednesday, June 26, 2002 11:33 PM
Subject: [Javascript] Objects with Javascript


> I am trying to do a simple example with a method in a class and I get a
> "Object does not support this property".  Does Javascript support such
> stuff...or...please let me know what I am doing wrong:
>
> <html>
> <head>
> <script language="javascript">
> function ToolBarController() {
> this.i = 0;
> function mo() {
> alert("I am in");
> }
> }
>
> function test() {
> TBC = new ToolBarController();
> TBC.mo();
> }
> </script>
> </head>
> <body onLoad="test()">
> </body></html>
>
>
>
>
> Pramod Jain
> INNOVATIVE DECISION TECHNOLOGIES, INC.
> (INDENT)
> 904.636.6374 X 12
> www.indent.org
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list