Sunday, December 26, 2010

Sunday, December 26 2010

This code is adapted from the JavaScript Cookbook by Shelley Powers.

It was edited with the help of http://www.jslint.com/




<htmL>
<head>
<title>JavaScript 1.2</title>
<script type = "text/javascript">
var numValue = 23.45;
var total = "And the total is " + numValue;
function writeData() {
alert(total);
}
</script>
<body onload="writeData()">
</body>



<html>
<head>
<title>JS Cook 1.3</title>
<script type="text/javascript">
function inquiry() {
var strName = prompt("What's your name?", "");
if(strName.toUpperCase() == "SHELLEY") {
alert("Your name is Shelley! Good for you!");
} else {
alert("Your name isn't Shelley! Too bad.");
}
}
</script>
<body onload="inquiry()">
</body>

No comments: