ASDV-WebDev/Semester 1/Chapter ZIPs/JavaScript/ch7/ex_7_15.html

21 lines
615 B
HTML

<html>
<head>
<title>Example 7.15</title>
<script type="text/javascript" src="mySource.js"></script>
<script>
function shipIt()
{
var shipCode = "FREEBIE";
var userCode = prompt("Enter your code:");
if (checkWord(shipCode, userCode))
document.getElementById('result').innerHTML = ("Shipping is free!");
else
document.getElementById('result').innerHTML = ("Sorry, your code is not valid");
}
</script>
</head>
<body><table align="center" width = "70%"><tr><td><br />
<input type ="button" onclick="shipIt()" value = "Enter free shipping code"><br />
<h3><span id = "result">&nbsp;</span></h3>
</body>
</html>