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 4

Instruction: In a Composer page answer the following questions (pages 20-44).

1. Explain the following statement: window.location="pepsi.html" The location property tells the browser to change the current page to the specified page in this case it would be "pepsi.html."

2.What do we mean by the term browser detection? Browser detection is used to find out what kind of browser the user has, so you can provide the most suitable page.

3. Conditional statements have ______ parts. Name the parts. Conditional statements have three parts: the if section , then section, and the else section.

4. In the if section, we do the _____________. test

5. In the then section, we place ________________ . the part of the script we want to do if the result is true.

6. In the else part, we place ________________ . the part of the script we want to have happen if the result of the test is not true.

7. In the if-then statement, what are in the parentheses, and braces? The parentheses are the holders for the content of the if section and the braces are the holders for the content of the then and else sections.

8. What is a loop in programming? A loop is something that allows you to repeat an action a specified number of times.

9. What is a counter? Where is it located usually? A counter is a variable that begins with one value an ends when a conditional test inside the loop is satisfied. The counter is located inside the parentheses.

10. What are the values of a counter? The values of a counter are the i set to a number (i=07#41;, the variable (i<navigator.plugin.lenght;) followed by the incremental amounts that the counter variable is equivalent to (i++).

11. What is the following script? for(i=0; i<navigator.plugin.length; i++); } This is the begining of the loop where i is set to 0 and the statement would read as "if i is less than the number of plug-ins, then add 1 to the value of i."

12. Explain the assignment i++. i++ means to increment the value of i by one.

13. What is a function in JavaScript? A function is a set of statements that performs a task.

14. A function can be invoked or ______________ . called

15. What is the following code? <;INPUT TYPE=BUTTON VALUE=&qout;math" onClick=&qoute;saySomething(good job )" /> The code creates a button when clicked will place a message "good job" on the screen.

16. What is saySomething in the above statement? saySomething is a function.

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

1. Using JavaScript, write a page in Composer that presents three multiple choice questions.

2. Provide descriptive feedback.

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