Use package name in function definition : Class Definition « Dojo toolkit « JavaScript DHTML






Use package name in function definition

 

<html>
  <head>
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/"
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
  </head>
  <body>
    <script>

      function com() { }
      
      com.java2s = function() { };
      
      com.java2s.method1 = function() { return "method1 called"; }
      
      alert(dojo.getObject("com.java2s.method1")() + ", " +
        dojo.getObject("com.java2s.method2", true) + ", " +
        dojo.getObject("com.java2s.method2", false));

    </script>
  </body>
</html>

   
  








Dojo-toolkit.zip( 3,849 k)

Related examples in the same category

1.Extend class
2.Use dojo to create class