2530 loCM Website
Assignments
Posted by senchent at 2005/06/29 08:10:58 PST
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)


Posted by senchent at 2005/06/27 09:12:19 PST
Edited at 2005/06/29 08:10:01 PST

Homework

  • Read chapter 8.

  • Do prelabs for chapter 8.

  • Answer research project questions used in the example "Using Technology in the Classroom" (view the Research Project page).

  • If you have not done so already, be sure to have read chapter 2 in On the Internet (small book).

  • Lab exercises for chapter 7 can be completed at home or in the lab on Wednesday.

Prelab Answers

Chapter 7 Review Questions

4. sequence, selection (or conditional or branching or if/then), looping (or iteration), transfer (or go to or jump)
7. true
9. b and e
13. mouseover, onmouseover

Chapter 7 Exercises

7.1

(a) A runtime error is an error that occurs when the script or program is actually run (executed).
(b) An event handler is an attribute in certain HTML elements that is triggered when an event for that element occurs (e.g., an onclick event handler for a click button) and then activates certain specified JavaScript commands.
(c) An interpreter is a software program that takes the programmer’s source code and translates one line at a time into machine code and then executes the resulting machine code before moving on to the next high-level instruction to translate and execute.
(d) A script is a (relatively) small program that runs within the confines of an application.

7.2

1. Sequence: Following the instructions for assembling a toy, in proper order.
2. Conditional: Deciding whether to buy something based on its price (“If it’s less than $100, then I’ll buy it; otherwise, I won’t”).
3. Looping: Stapling, folding, and stamping a stack of newsletters for mailing. (Staple one, then fold it, then stamp it. Staple the next one, then fold it, then stamp it. And so on.)
4. Transfer: Switching from one task to another task, e.g., someone who’s working on a math homework problem decides that “at 2 pm I’ll stop working on it and jump to the next problem, even if I’m not done.”

7.6

<script type="text/javascript">
alert("Good to see you") //First of the three welcome messages
alert("Having a nice time?") //Second message
alert("See you later") //Third message
</script>

7.7

<form>
<input type="button" name="testBtn" value="Display an alert"
onclick="alert('This is just a test')" />
</form>

7.10

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www/w3/org/TR/xhtml/11/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Problem 7.10</title>
<script type="text/javascript">
alert("Message Number 1")
alert("Message Number 2")
</script>
</head>

<body>
<noscript>This page requires the use of a JavaScript-capable browser</noscript>
<script type="text/javascript">
alert("Message Number 3")
</script>
<form>
<input type="button" name="messageBtn" value="Click here!"
onclick="alert('Message Number 4')" />
</form>
</body>
</html>


Posted by senchent at 2005/06/24 12:00:58 PST
Edited at 2005/06/24 13:15:17 PST

Homework

  • Read chapter 7 (skip chapter 6)

  • Do the prelabs for chapter 7, finish lab exercises for chapter 5.

  • Read chapter 2 in your internet handbook (smaller book)

  • Make sure to bring in a paragraph describing your project if you have not done so already!

  • Also be sure to bring in any permission or emergency forms that you have not already turned in.

Prelab Answers

Chapter 5 Review Questions

3. d
7. a
8. c
10. c

Chapter 5 Exercises

5.1 Briefly explain the following terms: external link, internal link, index.html file.

(a) An external link is a link that, when clicked, takes the surfer from the currently displayed Web page to the beginning of another page.
(b) An internal link is a link that takes the surfer from one part of a Web page to another section in the same page.
(c) An index.html (or index.htm) file is the default name given to the introductory page of a Web site, so that when a Web server receives a request but the document isn’t specified, it responds by sending the index.html file from the appropriate directory (assuming it exists).

5.9 Write the HTML code that would create a “Back to top” link for a Web page. Assume that the first line displayed on the Web page is “Welcome to the Marine Mammals Page!”

<body>
<a name="topofpage">Welcome to the Marine Mammals Page!</a>
<!--Rest of page goes here...-->
<a href="#topofpage">Back to top</a>
</body>


Posted by senchent at 2005/06/22 20:02:56 PST
Edited at 2005/06/22 22:04:42 PST
Chapters 3+4

Homework

  • Read Chapter 5

  • Do the prelabs for Chapter 5

  • Make sure lab exercises up to chapter 4 are complete.

  • Bring in your project idea with at least a paragraph explaining it.


Prelab Answers

Chapter 3 Review Questions

1. b
3. c
4. d
6.

<style type="text/css">
p {text-indent:15pt}
</style>

8. true

Chapter 3 Exercises

3.6 Write the HTML code that would uses the font property to define a paragraph style with 16-point italic text and a 32-point line height.

<style type="text/css">
p {font: italic 16pt/32pt}
</style>

Note: See also the answer to 3.3 regarding the <head> and <meta> elements.

3.7 Write the HTML code that would define a paragraph class named “doublespace” that modified the regular paragraph style (however defined) to make it doublespaced. Also write the code for a sample paragraph of this class.

<style type="text/css">
p.doublespace {line-height:2}
</style>

Note: Alternatively, doublespacing may be specified as line-height:200%. See also the answer to 3.3 regarding the <head> and <meta> elements.

The code for a sample paragraph will be:

<p class="doublespace">Here is the text of the paragraph</p>

3.10 Write the HTML code that creates an external style sheet with style definitions for the code in Problems 3.6 and 3.7. Assuming that this style sheet has been saved in a file named teststyle.css, show how to write the HTML tag that you would place in the document where you wanted to apply the styles.

The code in the external style sheet file will be:

p {font: italic 16pt/32pt}
p.doublespace {line-height:2}

The tag to place in the source document will be:

<link rel="stylesheet" type="text/css" href="teststyle.css" />

Chapter 4 Review Questions

1. True
5. <!-- and -->
6. ordered and unordered
7. a
8. disc, square, and circle

Chapter 4 Exercises

4.2

Answer for styles:
<style type="text/css">
body {background-color:purple; color:white}
</style>

This <style> element would be placed in the <head> element.

Answer for attributes:
<body bgcolor="purple" text="white">
Web page text and elements go here...
</body>

4.4

<ul type="square">
<li>Item 1</li>
<li>Item 2</li>
<!-- <li>Item 3</li> -->
</ul>

4.7

<ol type="A">
<li>Major PC Manufacturers ca. 2000</li>
<ol type="1">
<li>Dell</li>
<li>IBM</li>
<li>Apple</li>
<li>Hewlett-Packard</li>
<li>Compaq</li>
</ol>
<li>Personal Computer Operating Systems ca. 2000
<ol type="1">
<li>Microsoft Windows (various flavors)</li>
<li>Mac OS</li>
<li>Linux</li>
</ol>
</ol>

4.10

<table cellspacing="5" cellpadding="3">
<tr>
<th colspan=3>Great Places to Eat</th> <!--This also could be a <tr> element, not <th> -->
</tr>
<tr>

<th>Restaurant</th>
<th>Type of Food</th>
<th>Personal Rating</th>

</tr>
<tr>

<td>Strings</td>
<td align="center">Italian</td>
<td>3 stars</td>

</tr>
<tr>

<td>Dos Coyotes</td>
<td align="center">Fresh Mex</td>
<td>4 stars</td>

</tr>
<tr>

<td>Symposium</td>
<td align="center">Greek</td>
<td>3 stars</td>

</tr>
<tr>

<td>The Graduate</td>
<td align="center">Burgers</td>
<td>2 stars</td>

</tr>
</table>

Powered by Io Community Manager