1. Create a new directory under fit100 to store your Lab #6 files.
Give the folder an appropriate name like lab6.
2. In the folder, create a bare bones HTML file like below:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="lab6.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
Save the file as lab6.html. Notice the bold
line. This line links your HTML file to the JavaScript file
that you will create in the next step.
3. Start a new file in Notepad (or TextEdit for Mac). Save this file as
lab6.js. Notice that the filename is the
same as in the bold line above. If you want a different JavaScript filename, the
filename in the bold line would have to change too. When saving your
file, make sure your text editor does NOT add a .txt
file
extension.
4. In your JavaScript file, type the following:
alert("Hello, world!");
5. After saving your JavaScript file, load the HTML file in a web browser. Do you
see a popup box telling you Hello, world!
? If not, double-check that
you followed all the steps. If you are still having trouble, ask a neighbor or your
TA!
Yay! You've made your first JavaScript program!