var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); var Shape = function(){} Shape.prototype.Circle = function(){ // Some code here }; Shape.prototype.Square = function(){ // Some code here }; MainMenu.prototype = new Shape(); var MainMenu = function(ctx){ this.draw{ this.Circle(); this.Square(); } }
<html> <head> <title></title> <script type="text/javascript" language="javascript"> var Shape = function () { } Shape.prototype.Circle = function () { alert("Calling circle"); }; Shape.prototype.Square = function () { alert("Calling Square"); }; var MainMenu = new Shape(); MainMenu.draw = function (ctx) { this.Circle(); this.Square(); }; function callThisOne() { MainMenu.draw(null); } </script> </head> <body> <input type="button" value="Click" onclick="callThisOne();" /> </body> </html>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.