Reputation: 3
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?
Upvotes: 0
Views: 111
Reputation: 1009
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>
Upvotes: 2