0

so in my html file i have

<!Doctype HTML>
 <html>
  <head>
  <title>Orange’s Game</title>
  <meta charset="utf-8">
   <script src="game.js”></script>
  </head>
  <body>
   <input type="button" onclick="startgame()" value="Start" />
  </body>
 </html>

and in the game.js i have

var startgame = function(){
 alert('GO!');
}

the supposed button is actually a text box, and everything I have looked up does not seem to work. I am on OS X Yosemite.

EDIT Ok, so I have got a button now, but now, how do I get it to run the script?

1 Answers1

2

Change to ".

It appears your text editor is changing quotation marks to smart quotes, which the browser doesn't understand.

<!Doctype HTML>
 <html>
  <head>
  <title>Orange’s Game</title>
  <meta charset="utf-8">
   <script src="game.js"></script>
  </head>
  <body>
   <input type="button" onclick="startgame()" value="Start" />
  </body>
 </html>
royhowie
  • 11,075
  • 14
  • 50
  • 67
Rex Adrivan
  • 993
  • 1
  • 10
  • 23