title: When I run my window.onload function, I get unexpected token illegal
body: <p>Please help, when I run my <code>Window.onload()=dank();</code> function, I get the error message, unexpected token illegal.</p>
  
  <pre><code>&lt;html&gt;
  &lt;style&gt;
  &lt;/style&gt;
  &lt;body background="background.jpg"&gt;
  &lt;canvas id="canvas" width="1300" height="630"&gt;&lt;/canvas&gt;
  &lt;script&gt;
  var canvas=document.getElementById("canvas"); 
  var ctx = canvas.getContext("2d");
  var H=canvas.height;
  var W=canvas.width;
  var x=10; 
  var y=15;
  var rightPressed=false;
  var leftPressed=false;
  var upPressed=false;
  var downPressed=false;
  var heroX=20;
  var heroY=20;
  //this is where the error is
  </code></pre>
  
  <p>Function not working correctly</p>
  
  <pre><code>Window.onload()=dank();
  function dank(){
  alert("How to play: move your hero using the arrow keys, and collect colored balls for powerups and points!
  Get the highest score you can without touching a monster, which makes you    start over!
  Collect the colored balls for more and better special powerups.");
  }
  document.addEventListener("keydown", keyDownHandler, false);
  document.addEventListener("keyup", keyUpHandler, false);
  </code></pre>
  
  <p>This is the main game function</p>
  
  <pre><code>function draw(){
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  var heroImage=new Image();
  heroImage.onload=function(){
  ctx.drawImage(heroImage , heroX, heroY);
  }
  heroImage.src="hero.jpg";
  dope();
  }
  function keyDownHandler(e) {
  if(e.keyCode == 39) {
  rightPressed = true;
  }
  else if(e.keyCode == 37) {
  leftPressed = true;
  }
  else if(e.keyCode == 40) {
  downPressed = true;
  }
  else if(e.keyCode == 38) {
  upPressed = true;
  }
  }
  
  function keyUpHandler(e) {
  if(e.keyCode == 39) {
  rightPressed = false;
  }
  else if(e.keyCode == 37) {
  leftPressed = false;
  }
  else if(e.keyCode == 40) {
  downPressed = false;
  }
  else if(e.keyCode == 38) {
  upPressed = false;
  }
  }
  function dope(){
  if(rightPressed) {
  heroX += 7;
  }
  else if(leftPressed) {
  heroX -= 7;
  }
  else if(upPressed){
  heroY -= 7
  } 
  else if(downPressed){
  heroY +=7;
  }
  }
  setInterval(draw, 10);
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>