Well I didn't get far.
I'm stuck on Namespaces in JavaScript.
The following does not work:
Expand|Select|Wrap|Line Numbers
- <html>
- <body>
- <script type="text/javascript">
- Type.registerNamespace("MyNamespace");
- MyNamespace.Foo = function(firstNumber,secondNumber){
- this.a = firstNumber; //"a" is now a property of the Foo Object
- this.b = secondNumber;//"b" is now a property of the Foo Object
- };
- MyNamespace.Foo.prototype = {
- Add: function(){return this.a + this.b;},
- Divide: function(){return this.a/this.b;},
- Multiply: function(){return this.a * this.b;}
- };
- MyNamespace.Foo.registerClass('MyNamespace.Foo');
- var MyNamespace.instanceOfFoo = new Foo(2,3);
- document.write(instanceOfFoo.Multiply());
- document.write("<br />");
- </script>
- </body>
- </html>
If I remove the Namespace, it works fine:
Expand|Select|Wrap|Line Numbers
- <html>
- <body>
- <script type="text/javascript">
- Foo = function(firstNumber,secondNumber){
- this.a = firstNumber; //"a" is now a property of the Foo Object
- this.b = secondNumber;//"b" is now a property of the Foo Object
- };
- Foo.prototype = {
- Add: function(){return this.a + this.b;},
- Divide: function(){return this.a/this.b;},
- Multiply: function(){return this.a * this.b;}
- };
- var instanceOfFoo = new Foo(2,3);
- document.write(instanceOfFoo.Multiply());
- document.write("<br />");
- </script>
- </body>
- </html>
Is the Type class part of the Ajax Framework that ASP.NET uses? Or is it a native JavaScript Object?
Thanks again,
-Frinny