Site hosted by Angelfire.com: Build your free website today!

JavaScript Labs

Annette Mayville
Dr. Johari
Advanced Web Communication and Design

In the Lab, Mini Project 3

Instruction: In a Composer page answer the following questions (pages 13-24).

1. Where do we put the Java Scripts? Explain the difference between a header and or a body script. The header script is placed in the <head> section of the HTML and the body script is placed in the <body> section of the HTML. The header script will run as the page is loaded, and the body script will run after the page is loaded, and in some cases, may require some action on the user's part.

2. What is the the following? document. write("Hello, world!") This script tells the browser to write "Hello, World!" in the borwser window. The words will appear in the body area of the HTML page.

3. Why do we hide scripts from the old browsers? Older browsers like Netscape 1.x and Internet Explorer version 3 do not understand JavaScript. They were supposed to ignore the script, but insead they will display the script on screen.

4. What is the purpose of putting comments in scripts? The purpose of commenting scripts is to help remind you later of the commands used for the script. Also, this will help other people who may want to reuse and modify your script.

5. What is the main purpose of alert dialog boxes? An alert dialog box is a pop up window that gives the user important information that they need to know about a web site.

6. What kind of statement is an alert code? An alert code is called a method because the object is doing something.

7. Write an alert statement indicating a warning. alert("Warning, Will Rodgers!")

8. What are the following symbols: */ The symbols tells JavaScript to ignore everything until the end of the comment. This is used for a multiline comment. If you only want to do a single line comment then you would use // instead.

9. Explain the following tag: <SCRIPT LANGUAGE JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> It is called the opening script tag. It tells the browser to expect a JavaScript instead of HTML.

10. What are the HTML container tags that hold the Scripts? <script> and </script> are the HTML container tags for the JavaScripts.

Instruction 2: Using Composer and your book's site (its scripts), perform the following tasks:

1. Write a page in Composer that presents a multiple choice mathematics problem.
2. Develop another page (file) that provides guided feedback --- (try again) alert windows.
3. Construct another page that provides positive feedback and links the user to another math problem.

Click here to see a example of a try again alret window.