Extend class : Class Definition « Dojo toolkit « JavaScript DHTML






Extend class

 

<html>
  <head>
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/"
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
      function FirstName() {
        var firstName = "first";
        this.getFirstName = function() {
          return firstName;
        }
      }
      function LastName() {
        var lastName = "last";
        this.getLastName = function() {
          return lastName;
        }
      }
      function NameOutput() {
        this.sayName = function() {
          alert(this.getFirstName() + " " + this.getLastName());
        }
      }
      dojo.extend(NameOutput, new FirstName(), new LastName());
      var name = new NameOutput();
      name.sayName();

    </script>

  </head>

  <body></body>

</html>

   
  








Dojo-toolkit.zip( 3,849 k)

Related examples in the same category

1.Use dojo to create class
2.Use package name in function definition