Edited at 2005/07/08 08:52:17 PST
Homework
-
Finish lab exercises for chapter 8.
-
Read chapter 9.
-
Do prelabs for chapter 9.
Prelab Answers
Chapter 8 Review Questions
3. c
7. b
9. a
11. a
Chapter 8 Exercises
8.6 In a <script> element, write the JavaScript code that uses the prompt() method to ask the user to enter the name of their favorite movie. The code should store the movie name in a variable named favoriteMovie. After the user enters the movie name and clicks the “OK” button, an alert box should appear with the message, “That’s mine, too.”
<script type="text/javascript">
var favoriteMovie
favoriteMovie = prompt("Enter the name of your favorite movie", " ")
alert("That's mine, too.")
</script>
8.10 (a) Write the line of JavaScript code that would call the alert() method and display the value of the document.URL property.
(b) Write the line of JavaScript code that would call the alert() method and display the values of the document.title and document.URL properties in one alert box, so that the whole message is on one line using the format:
“The title is [title is displayed here] and the URL is [URL goes here].”
(c) Show how to modify the code in (b) so that the second part of the sentence, starting with “and the URL is...” is displayed on a separate line in the alert box.
(a) alert(document.URL)
(b) alert("The title is " + document.title + "and the URL is " + document.URL)
(c) alert("The title is " + document.title + "\r and the URL is " + document.URL)