function MyCanvas(width, height) { // Canvas Creation CODE DELETED. // save some info as local values this.width = width; this.height = height; this.ctx = canvas.getContext("2d"); this.dotSize = 1; this.dotCount = 100; return this; }
MyCanvas.prototype = { ChangeDot: function(sizeID) { // code goes here. }, ChangeCount: function(countID) { // code goes here. }, Redraw() { // code goes here. } };
Dot size: <input type="text" name="Dot Size" maxLength = "3" size = "3" id="DotSize", onchange="canvas1.ChangeDot('DotSize')">
ChangeDot: function(sizeID) { var sizeNode = document.getElementById(sizeID); var size = parseInt(sizeNode.value); if (size > 0 ) { this.dotSize = size; this.Redraw(); } },