title: instance.method is not a function (javascript)
body: <p>Hi I am quite new to javascript. So I just tried to create a simple object that draws two squares into the canvas. To understand object orientation a bit better I put them in different objects (where drawtest.js is the main). Unfortunately I dont see where my error lies. I have been searching posts on stackoverflow for hours, even the example from my prof looks (similiar) like mine, I don't see the difference but his version works. In firebug I get an:</p>
  
  <p><strong>testobject.draw is not a function</strong></p>
  
  <p>What did I forgot or made wrong?</p>
  
  <p>"index.html"</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;  
  
  &lt;head&gt;  
  &lt;title&gt;simple object test&lt;/title&gt;
  &lt;script src="js/drawtest.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="js/testobject.js" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;/head&gt;  
  
  &lt;body&gt;
  
  &lt;canvas id="canvas" width="300" height="300"&gt;&lt;/canvas&gt;  
  
  &lt;/body&gt;  
  
  &lt;/html&gt; 
  </code></pre>
  
  <p>the testfile "drawtest.js"</p>
  
  <pre><code>window.onload = function(){ init(); };
  
  var canvas;
  var context;
  
  function init() 
  {
  canvas = document.getElementById("canvas");  
  context = canvas.getContext("2d"); 
  
  testobject = new Test(context);
  
  testobject.draw();  //this is where I get testobject.draw is not a function
  
  }
  </code></pre>
  
  <p>the object "testobject.js"</p>
  
  <pre><code>function Test(context){
  
  this.context = context;
  
  
  Test.prototype=
  {
  
  draw:.
  function()
  {   
  this.context.fillStyle = "rgb(200,0,0)";  
  this.context.fillRect (10, 10, 55, 50);  
  
  this.context.fillStyle = "rgba(0, 0, 200, 0.5)";  
  this.context.fillRect (30, 30, 55, 50);  
  }
  };
  }
  </code></pre>