Why doesn't this work

Status
Not open for further replies.

goofymcdooperface

Reputable
Feb 19, 2014
64
0
4,640
<doctype! html>
<html>
<title> My test "game"
</title>

<body>
<script>
function Myfunction()
var x = prompt(" whats is your age?.");
if (x <13)
{
alert.("You may play the game but i take no response ability");
}
else
{
alert.("You are old enough to play . Have fun!!")
}
</script>
<button type = "button" onclick="Myfunction()"> Click me to play the game </button>
</body>
the goal is to have a pop up appear on your page when you press the button but for some reason chrome gives me an error message saying Uncaught SyntaxError: Unexpected token var

Uncaught ReferenceError: Myfunction is not defined

 
Status
Not open for further replies.