You have been hired by a company to build a Web page to sell their unique and unusual gift items. Their company's Web address is justplainstupid.com and their business name is "Just Plain Stupid." You will construct a one page Web layout with links to the items descriptions and pictures. Before you begin your venture, we will cover a few points about creating a Web page using HTML. For a more detailed account of HTML used in this activity, refer to the tutorials in your textbook (Creating Web Pages with HTML by Carey Associates, Inc.). The contents of this activity are viewed in the box below and are anchored to that particular section so all you have to do is click on the box you are working on, and it will take you to that section in this activity. Remember where you left off at the end of class so that you will be able to easily find the section in the table of contents below.

1. Document Content and Tags 2. Heading Size

3. Creating A Paragraph

4. Lists
5. Character Tags 6. Inserting a Horizontal Line
7. Creating and Inserting an Image 8. Creating Hypertext Links Between Elements Within Your Document
9. Anchor Tags 10. Define A Color Theme
11. Modifying Text with the <FONT> Tag 12. Web Page Structure
13. Creating Links Between Documents 14. Linking to Documents Found in Different Folders
15. Linking to Documents on the Internet 16. To Create a Link to an E-mail Address
17. Creating a Text Table 18. Formatting A Table
19. Cell Alignment 20. Table Header
21. Creating a Background for Your Web Page 22. Adding Border Color to Your Table
23. Adding a Colored Background to Your Table 24. Entering Data into Your Table
25. Creating a Button in Fireworks 26. Giving Your Title Some Oomph!!!
27. Using the ALT Property with Image Tags 28. Aligning Text Around An Image
29. Programming with JavaScript 30. The Script Tag
31. Sending Output to a Web Page 32. Creating JavaScript Functions
33. Creating Arrays 34. Working with Loops
35. Using the If...Else Statement 36. Grading Rubric

Document Content and Tags

(Tutorial 1 in Textbook)

An HTML document has two elements: document content and tags. Document content are those parts of the document that you want the user to see, such as text and graphics. Tags are the HTML codes that indicate the document content. To start creating an HTML file:

Now that the basic structure of the company's page is set, you will now start filling in the details. You need to enter the title of the company at the top of the page. You can do this in two ways. One, by heading levels (one being the largest and six being the smallest) or font size. For this exercise you will use headings to manipulate the size of your text. You also want to align the text to center on the page.

Heading Size

For the title you will choose the heading size of 1 (H1) and the heading size 2 (H2) for the subtitle. Between the body tags <BODY> and </BODY>, type the following text:

<H1 ALIGN=CENTER>JUST PLAIN STUPID</H1>

<H2 ALIGN=CENTER>The Wildest and Wackiest Gifts on the Web</H2>

FYI: To align text to the left side of your page, leave out the text align=center. Example:

<H2>The Wildest and Wackiest Gifts on the Web</H2>

Creating A Paragraph

You will now add a paragraph that will describe this business. Make sure to make it cute and snappy, because you want to keep your viewers on this Web page to shop. The HTML tags for a paragraph are <P> </P>. After the </H2> hit the enter key to go to the next line. Enter the <P> tag, then type in the description of the business followed by the closing paragraph tag </P>.

FYI: If your text is not automatically wrapping in Notepad, choose the Word Wrap command on the Edit menu. This will force the text to wrap so you can see it all on your screen. Also, you must enter the <P> </P> tags for every paragraph you enter.

Save the changes you have made. Remember to save it as all files and type in the html extension on the end. Return to your browser and reopen plainstupid.html to see how your document now looks.

Creating Six Categories

Go to the following Web sites and view the types of gifts this business will be selling. Your clients have instructed you that the gifts that will appear on their Web page will be the craziest items sold on the Web, however, they will only sell products that are in good taste. You will need to come up with six categories for the gifts, different from the competitors categories. Although you will be using the graphics from these sites for this activity, your site will have a totally different look and the description of the gifts will reflect your own creativity. First, come up with at least six different category labels. The wittier the better! Now you will center these categories down the center of your page using the H3 header. Place your cursor behind the end paragraph tag </P>, press the enter key, and insert the HTML code that will align your text in the center of the page with the H3 header.

Wonderfully Wacky Gifts

Someplace Else 2000

Save your document then open it in your browser to see the changes.

Lists

You will now create an unordered list to emphasis the strengths of this company. Your unordered list will look like the following:

Place your cursor after the </P> tag, which ends your paragraph, then press the enter key to start a new line. There are three types of list. An ordered list is used when you want to place the numbers 1, 2, 3, etc. in front of your list. An unordered list, which is what you will use for the list above, places bullets in front of each item. The third type of list is the definition list which is a list of terms, each followed by a definition line, usually indented slightly to the right. The following codes are how the HTML should be placed in your document.

For an ordered list:

<OL>

<LI>

<LI>

<LI>

</OL>

For an unordered list:

<UL>

<LI>

<LI>

<LI>

</UL>

For a definition list:

<DL>

<DT>

<DT>

<DT>

</DL>

Open your document in Notepad, if its not already open, and add the HTML code for an unordered list to your document. Add the four items listed above. Make sure you enter the capital I, not the number 1 when inserting your HTML code. Save your file then reload it in your browser.

Character Tags

The tags used up to now have affected either the entire document or line. HTML also allows you to modify the characteristics of individual characters which is called a character tag. The character tags we will examine closely are classified as physical character tags which change the format of the text. The following are common examples of physical character tags.

<B>
Text appears bold
<I>
Text appears italic
<TT>
Text should be used with a font like Courier that allots the same width to each character
<BIG>
Text will display in big font
<SMALL>
Text will display in small font
<SUB>
Text is displayed in subscript
<SUP>
Text is displayed in superscript

To emphasis your unordered list more, you will add the bold HTML code to your document. To add character tags to the plain stupid file:

Place your cursor behind the <LI> tag and insert the <B> tag. To stop the bold command from displaying throughout your entire page, place your cursor in front of the </UL> tag and insert the end of bold text tag </B>. Save your document then view it again in your browser.

For more listings of character tags, look in Appendix C in the back of your textbook.

Inserting a Horizontal Line

To lend more shape to the appearance of your page, you will now add a horizontal line after the heading "The Wildest and Wackiest Gifts on the Web." Place your cursor after the end heading tag and press enter. In the new line, type <HR>. Save your changes and view it in your browser.

To give your horizontal line a little more depth, replace the <HR> tag with the following:

<HR ALIGN=CENTER SIZE=12 WIDTH=100%>

Save your changes then view it in your browser.

Creating and Inserting an Image

You will now create an image to display on your page. Because your clients don't want to deal with any copyright issues, they have requested that you design an image that will represent their company. The Web only supports two graphic types for inline images: GIF (Graphics Interchange Format) and JPEG (Joint Photographic Experts Group). Of these, the GIF file format is the more common on the Web. We will first create an image in Flash that does not save files in the GIF format. You will be instructed later in this activity on how to change this image to a GIF format that compresses the size of the image file.

First, open Flash from your program files. You will first create the image below to get acquainted with the variety of drawing tools available in this program. You will then create your own image for this Web page.

 

You will now create your own image for this Web page activity. Start a new file in flash and experiment with other drawing features in flash to create an image that will reflect the stupid company image. Follow the directions above to convert the image to a GIF format and save it to your student folder.

With this image in your student folder, you will now place it on your Web page. You will place the image after your paragraph. Place your cursor after the closing paragraph tag and press the enter key to start a new line. The general syntax for an inline image is:

<IMG SRC="filename">

The filename is what name you assigned your image when you saved it. You will center the image on the page. You will nest the image tag within a paragraph tag and then set the alignment property to center it in the opening paragraph tag. Return to your text editor with the plainstupid file open. Make sure your image file is also in your student folder or you will have to specify the path to where your file is located, which will be discussed later. Type the following on your new line:

<P ALIGN=CENTER><IMG SRC="filename.gif"></P>

Save your document and reload it in your browser. If your image appears to be too large for the page, resize your image in Fireworks following the instructions above and resave it. Continue until you get the image the size you want.

Tutorial 2 in Textbook

Open the file plainstupid.html in your text editor. After adding your image and horizontal rule, the categories you created have moved further down on the page, not allowing viewers to see everything without scrolling down the page. You will now create hypertext links between elements within your document. First you will need to assign short names to any category that contains more than one word, for example, Gifts for Him would be assigned the name Guys.

Creating Hypertext Links Between Elements Within Your Document

Save your file and view it in your browser. Three categories should appear on the left of the image, and three should appear on the right with bullets separating them.

Anchor Tags

Now that you've created the text for your categories, you need to locate each heading and mark the heading text in the document using the anchor tag <A>. This tag creates an anchor, text that is specially marked so you can link to it from other points in the document. You assign each anchor its own anchor name, for this exercise, you can use the one word description used in the above exercise or use an abbreviation. Make sure no spaces appear in the word.

Creating anchors:

<A NAME="anchorname">

For example, if you want the text "Gifts for Him" to be an anchor, you could assign it the anchor name "Guy.":

<A NAME="GUY">Gifts for Him</A>

FYI: An anchor doesn't have to be just text. You can also mark an inline image using the same syntax:

<A NAME="IMAGE">IMG SRC="filename.gif"</A>

Locate the H3 heading for your first category. (Example, Gifts for Him) Place the cursor after <H3 ALIGN=CENTER> and type the anchor tag <A NAME="anchorname"> then place your cursor before the </H3> tag and type </A>. Continue creating anchors for the rest of your categories.

After you anchor the text that will be the destination for your links, you need to create the links themselves. For this activity, you want to link the text you entered around your image to the six categories. To create a link to an anchor, you use the same tag you used to create the anchor. The difference is that instead of using the NAME property to define the anchor, you use the HREF property, short for Hypertext Reference, to indicate the location to jump to. For example, to create a link to a location in the current document with the anchor name "Guy," you enter this HTML command:

<A HREF="#GUY">Guy</A>

FYI: To turn an inline image into a hypertext link, place it within link tags, as in:

<A HREF="IMAGE"><IMG SRC="filename.gif">

Return to your text editor. Locate the paragraph tag that contains the six categories nestled within the image file. Within that paragraph you need to bracket each occurrence of a category title with a link tag. Place your cursor in front of your first one word category (example: Guys), and type <A HREF="#onewordcategory" and at the end of the category name add the closing anchor </A>. The link will not work if you leave the # out. Your code should look similar to the following:

<A HREF="#Guys">Guys</A>

Save your word document and reload it in your browser. Check to see if your link works.

Define A Color Theme

(Tutorial 3 in Textbook)

HTML identifies a color in one of two ways: either by the color's name or by a description of the color's appearance. For more information on the advantages and disadvantages of these methods, refer to tutorial 3 in your textbook.

The first method is by typing in the color name. There are 16 color names that are recognized by all versions of HTML. These color names are shown below:

AQUA
NAVY
BLACK
OLIVE
BLUE
PURPLE
FUCHSIA
RED
GRAY
SILVER
GREEN
TEAL
LIME
WHITE
MAROON
YELLOW

The second method uses a mathematical approach to define color. One method is know as an RGB triplet where three numbers are used that are based on its red, green, and blue components. Aqua is defined as (0,255,255). The first number represents the intensity of red, the second number, the intensity of green, and the third number, the intensity of blue. Another method is the hexadecimal approach which represents numbers using 16 as a base rather than 10. Have I blown your mind yet? If you want a more complex explanation of this method, refer to page 3.7 in your textbook. You will not need to worry about these numbers because in Appendix A in the back of your textbook you will find both methods decoded for you along with a color swatch of that specific color.

You will experiment with these colors for your page by specifying a background color for your page, the color of your text, links, and vlinks (color of previously visited hypertext links). If your plainstupid word document is not open, open it in Notepad. Locate the beginning body tag (<BODY>) and edit it to read:

<BODY BGCOLOR=Color TEXT=color LINK=color VLINK=color>

Here, the BGCOLOR property sets the background color, the TEXT property controls the text color, the LINK property defines the color of hypertext links, and the VLINK property defines the color of links that have been previously visited by the user. The value of color will be either one of the accepted color names or the color's hexadecimal value. If you use the hexadecimal value, you must use the pound symbol (#) and enclose the string in double quotation marks. For example, the HTML tag to create a background color with the hexadecimal value FFOO88 is:

<BODY BGCOLOR="FFOO88">

Open you textbook to Appendix A and experiment with different colors to see their effect. Now that you understand about color themes, return the beginning body tag to its original state (<BODY>). You will have an exercise later where you will create your own background like the one seen on this page. You can then edit your text, link, and vlink colors to match your background.

In choosing your color theme, you should remember to use colors that will not detract from your page's text, making it hard to read.

Modifying Text with the <FONT> Tag

Specifying the text color in the <BODY> tag of your Web page changed the color of all the text on the page. Occasionally you will want to change the color of individual words within the page. Color that affects only a few sections of a page is called spot color. You can do this using the <FONT> tag. The <FONT> tag gives you even more control by allowing you to specify the color, size, and even the font to be used for the text on your page. The syntax for the <FONT> tag is:

<FONT SIZE=size COLOR=color FACE=font>The text that will be revised</FONT>

Return to the plainstupid text document in Notepad. Locate the following heading:

<H2 ALIGN=CENTER>The Wildest and Wackiest Gifts on the Web</H2>

Edit this heading using the font tags above, using a font size of 5, color=fuchsia, and font face of helvetica. You should now show the following:

<FONT SIZE=5 COLOR=FUCHSIA FACE=HELVETICA>The Wildest and Wackiest Gifts on the Web</FONT>

Save your text document and view it in your browser. Notice that is no longer centered. Do you remember the code used to align your text to the center? To center the text, you must embed the center=alignment in a paragraph tag. Make the following changes then save your work and view it in your browser.

<P ALIGN=CENTER>

<FONT SIZE=5 COLOR=FUCHSIA FACE=HELVETICA>The Wildest and Wackiest Gifts on the Web</FONT>

</P>

You will leave this code in your word document, however, change the font color to black. When you create your background later, you can then go back and change the color and face to whatever you want.

Web Page Structure

(Tutorial 2 in Textbook)

You will now create additional pages that will contain the picture, description, and price of each gift. Each category will have a separate page, which will contain all the gifts available for that category. This technique of laying out how your pages will be displayed is called storyboarding. The two most common page layouts are:

Linear structure, in which each page is linked to the next and previous pages in an ordered chain of pages. An example of this structure would be an online play where you would click the next button to go to the next page, or the back button to go the previous page.

Hierarchical structure is a system which starts with a general topic that includes links to more specific topics. Each specific topic includes links to yet more specialized topics. This is basically the style you will be using in this exercise.

Creating Links Between Documents

You will need to create a separate page for each category in Notepad and save it with a different name for each. Because your browser will be looking specifically for the name assigned, save it with a different name than your anchor or category names. For example, Gifts for Him where I assigned the anchor name Guys, I might name Men.html. You will need to center the category title on each page. (Example:<H1 ALIGN=CENTER>Gifts for Him</H1>) Create six different text documents, one for each category, and save it to your student folder. Make sure you save it as one complete word and don't forget to save it as all files and add the .html extension. View them in your browser window. You should see a blank page with the title of your category centered at the top of your page. Return to your plainstupid document.

Change the line reading "<H3 ALIGN=CENTER><A NAME="anchorname">Your first category name</A></H3> to:

<H3 ALIGN=CENTER><A NAME="anchorname"><A HREF="Nameofyourhtmlpage.html">Your first category title</A></H3>

Save your work then view it in your browser. Click on your first category to see if it takes you to the page that will show the gifts for that specific category. Continue until all six categories are linked to their different pages. Continue to save your work and check it out in your browser.

FYI:

Linking to Documents Found in Different Folders

To link to documents found in different folders, you must use the absolute path, which tells the computer exactly where the file is. In HTML you start every absolute pathname with a slash</>, then you type the folders' names on the computer, starting with the top most folder in the folder hierarchy and progressing through the different levels of subfolders. For more information, look on pages 2.21-2.23 in your textbook.

Linking to Documents on the Internet

To link to documents on the Internet you will need to know its URL, or Uniform Resource Locator. For example, to create a link to my Web page, you would use this HTML code:

<A HREF="http://jnicholson.www7.50megs.com">Lesson Plan Blues</A>

To Create a Link to an E-mail Address

To create a link to an e-mail address, for example: njanann@hotmail.com, you would enter the following into your Web document:

<A HREF="mailto:njanann@hotmail.com">njanann@hotmail.com</A>

Activity 3/Tutorial 4 in Textbook

Creating a Text Table

(Tutorial 4 in Textbook)

You will now construct a table to display the picture, description, and cost of your gifts. Open one of the six text documents created for each category. You will create a template that will then be copied to your other five text documents. With your text document open in Notepad, place your cursor after <H1 ALIGN=CENTER>Name of Your Category</H1> and press the enter key to place the general syntax for your graphical table on a blank line. You want a table that has three columns and six rows. Type the following code, using indentations for organization, that tells the computer you are building a table with the above specifications:

<TABLE>

<TR>

<TD>First Cell First Row</TD>

<TD>Second Cell First Row</TD>

<TD>Third Cell First Row</TD>

</TR>

<TR>

<TD>First Cell Second Row</TD>

<TD>Second Cell Second Row</TD>

<TD>Third Cell Second Row</TD>

</TR>

<TR>

<TD>First Cell Third Row</TD>

<TD>Second Cell Third Row</TD>

<TD>Third Cell Third Row</TD>

</TR>

<TR>

<TD>First Cell Fourth Row</TD>

<TD>Second Cell Fourth Row</TD>

<TD>Third Cell Fourth Row</TD>

</TR>

<TR>

<TD>First Cell Fifth Row</TD>

<TD>Second Cell Fifth Row</TD>

<TD>Third Cell Fifth Row</TD>

</TR>

<TR>

<TD>First Cell Sixth Row</TD>

<TD>Second Cell Sixth Row</TD>

<TD>Third Cell Sixth Row</TD>

</TR>

</TABLE>

Save your word document and open it in a browser. To get a better understanding of what the codes above mean, refer to the table below.

<TABLE> Begins table
<TR> Begins table row
<TD> Begins table data
</TD> Ends table data
</TR> Ends table row
</TABLE> Ends table

Notice the words that appear in your table. Before deleting the words, you will work on the appearance of your table because the table definitely lacks aesthetic value. Return to your text document that contains the table template and you will now change the appearance of the table itself. Locate the beginning of your table tag (<TABLE>) and change it to read:

Formatting A Table

<TABLE ALIGN=CENTER WIDTH=640 BORDER=10 CELLSPACING=5 CELLPADDING=2>

Save your text document and view it again in your browser, It's already looking better! By typing in the above code, you let the computer know that you wanted the table centered on the page with a width of 640 pixels and a border of 10 pixels. The cellspacing property controls the amount of space inserted between table cells, or in plain terms, the interior border thickness. Cellpadding refers to the space within the table cells. To see the difference in the two, change the number of pixels, save your document, then view it in your browser. When you are through experimenting, change the values back to the above specifications.

Cell Alignment

Notice that all the words are aligned to the left side of each cell. The first and fourth rows will contain pictures of the gifts and it would look better to have them centered in the cell instead of flushed to the left. In the first and fourth row, change all the cell tags to read: (Do not delete your text or you will not be able to see how your alignment will look!!!)

<TD ALIGN=CENTER>Text that Appears in Cell</TD>

Save your text document and again view it in your browser. The first and fourth row text should now be centered in the cell. Repeat this with rows three and six, they will contain the price of each gift. You will use the second and fifth rows to type in the description, and you will later decide if you want it to stay flushed to the left, or centered. For now, you will leave it aligned to the left. Save your changes and again view it in your browser. All rows should be aligned to the center except rows two and five.

Table Header

Now that you have the alignment the way you want it to appear in the table, you need to turn your attention to the H3 heading on the page. It would look a lot better embedded at the top of your table and the text changed to a heading size of 2. You want the heading to appear centered across all three columns. First, delete the H3 heading, remembering the name of the category title. Place your cursor after the beginning table tag (<TABLE ALIGN=CENTER WIDTH=640 BORDER=10 CELLSPACING=5>), press the enter key to start on a new line, then type the following table heading tag (TH):

<TH ALIGN=CENTER COLSPAN=3><H2>Category Title</H2></TH>

Save your text document and view it in your browser. Your category title extends across the three rows and is centered in the middle. You will return to the table to add some color, but before we do this you need to decide on a color theme for your page. I have chosen a light pink for this page. You, however, will create your own design and color theme. You will need to open Fireworks from your program files.

Creating a Background for Your Web Page

With Fireworks open, select file, then new. Specify the canvas size. I used 150 pixels by 150 pixels. Depending on what you want to do will help determine what size you will need. Make sure to use pastel or light colors so viewers visiting the page are able to see your text with little difficulty. Also, making your page too busy will become annoying to those visiting and we want to keep viewers there as long as possible. When you have completed your background, save it to your student folder. For this text background I selected the text tool, the button that shows a capital A. When you click the text button, a dialog box will open. If you decide to use text, you will need to decide on a font style and color. When you have finished typing in what you want, click OK. To rotate or resize your text, select the arrow tool, select the text by clicking once on it, then select modify on your standard toolbar then choose Free Transform. When you have your background tile the way you want it, place it in your plainstupid text document, then view it in your browser. What you think looks good on a small tile might not be at all what you thought it would be as a background. Continue to modify your background, viewing it in your browser till you get the result you want. To place your background on your page, locate the beginning body tag (<BODY>) and change it to read:

<BODY BACKGROUND="imagename.png">

Where imagename is the name you assigned to your background tile with the png extension. This extension lets you know that this image was created in fireworks. You could also export as a gif file as before, then you would then type the gif extension (.gif).

After you have successfully placed your background on your main page, reopen the table template page in Notepad and place your background on this page as you did above. You will now continue to modify your table by using different colors to enhance the look of your table.

Adding Border Color to Your Table

The first thing you will format is the border around the table. Using two different shades of the same color will give your table a 3-D border effect. You will need to find a dark and light shade of the same color that will go with your color theme. When you have the two hexadecimal values that you want to use, locate the beginning table tag (<TABLE ALIGN=CENTER WIDTH=640 BORDER=10 CELLSPACING=5 CELLPADDING=2>). First, place your cursor behind your beginning body tag and press enter to begin a new line. Your cursor should be under the beginning body tag and above the beginning table tag shown above. Type the following on the blank line:

<DIV ALIGN=CENTER>

With this text entered, you will now need to modify the table tag. Make the following changes to your table tag:

<TABLE WIDTH=640 BORDER=10 BORDERCOLOR=#hexadecimalvalue BORDERCOLORDARK=#hexadecimalvalue CELLSPACING=5 CELLPADDING=2>

Save your changes and view it in your browser. Change the hexadecimal values to you get the desired result you want to achieve.

Adding a Colored Background to Your Table

To create colored background for a table, row, or cell, enter the following tags:

<TABLE BGCOLOR=color>

<TR BACKGROUND=color>

<TD BACKGROUND=color>

<TH BACKGROUND=color>

Return to you table template in Notepad, locate the table heading tag. You will now change the color of the heading. Place your cursor after the beginning table tag (TABLE ALIGN=CENTER WIDTH=640 BORDER=10 CELLSPACING=5 CELLPADDING=2> and press the enter key create a blank line. Although you have specified the top of the table as a header, you must enter a TR tag to change the color. Your cursor should now be on an empty line between the beginning table tag and the table header tag. Make sure it is before the header tab. Type in the following:

<TR BGCOLOR=color>

Save your changes and view it in your browser. At this point, if you have a background you like, but the text will not show up clearly, you could use the bold tag or font color tag to change the appearance of your text. Remember, rows one and four will hold image files, so you will not need to worry about the appearance of this text. To change the font color, size or font, you must place the <FONT> tag behind your <TD> tag. Enter it in each cell you wish the changes to take place in.

Continue to change the colors in your table. Remember to make it pleasing to your viewers. If your table is too busy, it could be hard to read.

Now that you have your table the way you want it to look, you will need to delete the text that appears in each cell. For example, <TD>First First Cell, First Cell</TD> should be edited to look like <TD></TD> When you have removed all the text from your table, save it. Whew, what a lot of work but you have successfully make a template you can now copy into your other five category text documents. Open the remaining five pages and copy the table template into each of them, changing the table heading category to reflect the remaining five titles you have previously assigned to each.

Lets take a break from HTML!!! Return to the Web pages below to find the gifts you will display in your category pages. Save the images to your student folder. You will save six pictures per category, totaling thirty-six images in all. Remember that you want your table to look proportional with your pictures, so in the event your images are too small, or too large, you can change the size of them in Fireworks. Making all your images the same size would also add a more professional look to your page. Before you decide on the appropriate size, view one picture in your table and continue sizing it till it looks like you want it to. Remember, three images will be in one row, so you don't want to make the image wider than the table will hold. Another thing to keep in mind is that you also have two images per column.

Wonderfully Wacky Gifts

Someplace Else 2000

Entering Data into Your Table

Once you have saved all your image files, open your category Web pages in Notepad. Locate the first cell in row one, place your cursor between the <TD> and </TD> tags, and insert one of your image files that belong in that category using the image tag (<IMG SRC="filename.gif">). Next, locate the first cell in row two and type in a description of this image in your own words. Remember, you cut and paste in Computer Applications, Web Design is all about creativity. Make your description of the gift witty and humorous to your views. Finally, locate the first cell in row three and type in the price of the gift. Save your changes and view it in your browser. Repeat this with the remaining images and then with the next five Web categories pages.

Creating a Button in Fireworks

Open Fireworks under your program files. Start a new file with canvas dimensions of 150 pixels wide by 100 pixels high. Select transparent as your canvas color. You will select the rectangle or oval tool to draw the shape of your button. I choose a rectangle for an example:

Click and drag your oval or rectangle to open it on your canvas. If your object toolbar is not visible, click window on your standard toolbar then object. Click the stroke tab and drop down you menu and experiment with different stroke effects. Drop down your second menu choice box and notice other effects and colors you can choose from. Strokes outline your button.

You will now experiment with fill color using the fill toolbar which allows you to apply affect and texture to your button. Click the fill tab, then drop down the menu by clicking on the arrow button. These are additional features you can use with your fill. Experiment with several of these fills. Notice that if you choose solid, you have the same color choices you have on your color palette on your canvas by clicking on the color swatch arrow, however, you have a choice of applying a texture to your color. If you did not have a color previously chosen, you will have to click the paint bucket to apply your fill. When applying texture, continue pouring from your paint can to see the effect the texture makes on your canvas. If you are not seeing a texture appear, make sure you don't have 0% displayed. Drop down your arrow and choose a number, the larger the number, the more texture will be applied. Play around with the different options to get familiar with them.

Click on the effect tab. Drop down your menu box. Check out what each of these items will do. If you choose the multiple tab, you can apply more than one effect to your button. Once you have the button the way you want it, return to button on your canvas. Click the text button (the capital letter A) and type the word back. Make sure you choose font color and size that will be easily displayed. If you need to resize or move your text, you must choose the arrow key. Once your have the text displayed the way you want it to look, you will now assign a behavior to the button that when clicked on it will take you back to your home page.

To apply a behavior, you must first select the area on want to change when clicked on. Your selection will be the word back. With your arrow key, choose the text back. You will know that the text is selected if a blue box appears around the word. Choose Insert then select Hotspot, then chose Insert Behavior. Notice that the object toolbar changes and a behavior box opens. In the behaviors box, click the plus button to open a menu, and chose simple rollover. A dialog box will open asking if you want to include down or over state. Don't check either box. Click OK.

You will now need to define your link and alternate text in your object toolbar. If you don't see the objects toolbar on your canvas, select window on your standard toolbar, then choose object from the drop down list. Open the home page of Just Plain Stupid, copy the URL address by clicking in the location box, choose copy, the return to fireworks and click in the object toolbar, with the object tab selected, then click on the drop down box that displays a chain link and paste the location in this box. On the alternate text button type Just Plain Stupid.

Add one more behavior before saving and testing your button. Click the plus button again and chose Display Status Message. Type Just Plain Stupid. You will now group all objects associated with your button by holding down the control key and clicking on you button, hotspot, and your text. Click the modify button on your standard toolbar, then select group from your list of options. Remember how you cut your picture and repasted it to get rid of the extra space around your picture? You are going to do the same with your button. Select your button by clicking on it, then cut, open a new page, then paste your button. (If for some reason when you cut your picture and the text is not cut too, then you didn't group it with your button.)Save your button, then press F12 to view your button in a browser. Click on the button to see if it will take you to Just Plain Stupid home page.

Now you will place the button on all of your category pages. First you will save your button as a png file then as a htm file. To save your file in htm format, choose File, then export. Save as a gif, click next, then save as htm file. Because you have assigned behaviors to your button, you will have to copy a JavaScript into you document. One JavaScript will be typed in your section and the second JavaScript will be put in your between your tags just above the end of body tag. By saving your file in htm format, you can open the JavaScript in Wordpad or Notepad. The script will tell you where to copy and paste. To align your button to the center, in the image JavaScript, the one copied above the end of body tag, put it in a between paragraph tags with the command align=center. Save you document and view it in a browser. Check to see if your button works. You should have a button on all six category pages.

Giving Your Title Some Oomph!!!

Open Flash from your program files. Follow the steps below to create a title like the one at the beginning of this project.

Save it and view it in your browser. If your page looks different, make sure that you used the paragraph tag to embed your centered title image.

Using the ALT Property with Image Tags

(Tutorial 3 in Textbook)

The ALT property allows you to specify text that will appear in place of your inline image. This property is important because it allows users that have nongraphical browsers to learn the content of your graphic. Alternate image text also appears as a place holder for the graphic while the page is loading. Locate the <IMG> tag for the title image. Edit the <IMG> tag as follows:

<IMG SRC="image.gif" ALT="Just Plain Stupid">

Resave your text document, then view it in your browser. You will not see any change because you are viewing this page on a graphical browser. To see if your changes have been added, place your cursor over the title image. You should see Just Plain Stupid text appear. When you take your cursor off the title image, the text will disappear.

Aligning Text Around An Image

Return to plainstupid in your text editor, Notepad. You will make the following changes:

<P>

<IMG SRC="yourimage.gif">

</P>

The next line should be the paragraph with links to your anchors minus the image file you just cut from it. Save your changes and view it in your browser. Your image file should now be above your short category names, but flushed to the left side of your page. Next you will move the descriptive paragraph up next to your image. To do this, follow the steps below:

ALIGN=LEFT

Another problem needs to be fixed. There's not enough space separating the image the the surrounding text, which makes the page appear crowded. You can increase the horizontal and vertical space around the image with the HSPACE and VSPACE properties as follows:

<IMG SRC="image.gif"VSPACE=value HSPACE=value>

The HSPACE property increases the space to the left and right of the image, and the VSPACE property increases the space above and below the image. The value assigned is measured in pixels. Return to your image you just flushed to the left and edit the <IMG> tag as follows:

<P>

<IMG SRC="image.gif" ALIGN=LEFT VSPACE=5 HSPACE=15>

Save your changes and view it in a browser. Change the value to get the best result for your image.

Programming with JavaScript

(Tutorial 7 in Textbook)

Your clients want on additional item to appear on their Web page. They are counting on selling most of their gifts during the Christmas season and want to remind their viewers of the number of shopping days left before Christmas. Just entering "There are __ days left before Christmas," would require hiring someone to update the page manually each day. It would be much better if this task could be performed automatically by a program running on the Web page itself. You will create such a program in JavaScript, a programming language designed for Web pages. For a more detailed background in JavaScript refer to tutorial seven in your textbook.

The Script Tag

The <SCRIPT> tag is a two-sided tag that identifies the beginning and end of a client-side program. Your program can be placed anywhere within the HTML file, either within the <HEAD> tags or the <BODY> tags. One problem that can be encountered with JavaScript is that older browsers might not support it. To avoid this problem, you can hide the script using comment tags (tags that will not be seen by viewers). When using comment tags within the JavaScript, you must use a set of double slashes(//) at the beginning of a line to tell the browser to ignore the line and not interpret it as a JavaScript command. The syntax for doing this is as follows:

<SCRIPT LANGUAGE="JavaScript">

<!---Hide this script from browsers that don't support JavaScript.

JavaScript commands

//Stop hiding from other browsers -->

</SCRIPT>

Having seen the basic structure of a JavaScript program, you're ready to insert the necessary lines of code into the Just Plain Stupid text editor. Open this page in Notepad, scroll down the file until you locate the heading that reads "The Wildest and Wackiest Gifts on the Web," and place your cursor after the end heading tag. Press the enter key to place your cursor on a new line. Type in the above script.

With the <SCRIPT> tags and comments in place, your next task is to write a JavaScript program that sends output to the Web page.

Sending Output to a Web Page

JavaScript provides two commands to display text on a Web page: the document.write("text"); and document.writeln("text"); commands, where text is a text string that you want sent to the Web page. Note that each JavaScript command line ends with a semicolon to distinguish it from the next command in the program.

Now you must specify the text the program will use to determine the current date and then display that information (using a test date) on the page. To do this, you have to create a JavaScript variable. A variable is a named element in a program, used to store and retrieve information. Variables are given values through assignment operators, the most common being the equals sign. To assign the variable "Year," you would enter the following JavaScript command:

Year=2001

With the Year variable assigned a value, you can use the document.write() method to display this value on the Web page, as follows:

document.write(Year);

This code would cause the text "2001" to be displayed on the Web page. Before you can use a variable in your program, you have to create it. You declare a variable in JavaScript either by assigning it a value in a JavaScript command or by using the var command to to create it without assigning it a value.

Now that you've learned a little about the document.write() method, you'll add it to the JavaScript program you just created. Below the line "!-- Hide from non-JavaScript browsers," insert the following two comments replacing the text JavaScript commands(indented to make your code easier to read):

 

document.write("Today is 10/03/01<BR>");

document.write("Only 181 days until Christmas");

In your program for Just Plain Stupid, you'll be working with dates as you try to calculate the number of days remaining until December 25th.

To learn more about dates in a JavaScript program, refer to pages 7.14-7.16 in your textbook. For now, we will use a specific date, October 15th, to test your program. You will eventually set up the program to use the current date. You'll create the following five variables:

  • Today, which will contain complete date and time information. For this activity we will use the test date October 15th.
  • ThisDay, which will contain the day of the month, extracted from the Today variable.
  • ThisMonth, which will contain the value of the month, extracted from the Today variable.
  • ThisYear, which will contain the year value extracted from the Today variable.
  • DaysLeft, which will contain the number of days left until Christmas. Because you haven't calculated this value yet, you'll set this variable equal to 999 as a placeholder until you calculate the actual value.

Now you'll use these variables with commands based on variable values. Return to your program file and insert the following below the line "<!--Hide this script from browsers that don't support JavaScripts">:

 

var Today = new Date("October, 15, 2001");

var ThisDay = Today.getDate();

var ThisMonth = Today.getMonth() +1;

var ThisYear = Today.getYear();

Edit the line that reads document.write("Today is 10/03/01<BR>"); to read:

 

document.write("Today is "+ThisMonth+"/"+ThisDay+"/"+ThisYear+"<BR>");

Continue to key in the following lines directly below the last line entered above:

 

//Get number of days until Christmas

var DaysLeft = 999;

Edit the line that reads document.write("Only 181 days until Christmas"); to read:

 

document.write("Only " + DaysLeft + " days until Christmas");

Save you changes and view them in your browser. The text not only is hard to see, but it needs to aligned to the center. Change the text to have a H3 heading and is aligned to the center. Save your changes and then view them in your browser. The heading and center alignment commands should appear above the beginning script tag. Don't forget to place a closing H2 tag at the end of the script tag.

 

Creating JavaScript Functions

A function is a series of commands that either performs an action or calculates a value. A function consists of the function name, which identifies it; parameters, which are values sent to the function; and a set of commands that are run when the function is used. Not all functions require parameters. Two things to remember about functions. One, functions are case-sensitive. XMAS and xmas are considered different function names. Second, a function name must begin with a letter or underscore (_) and cannot contain any spaces. Where you place a function in the HTML file is important. The function definition must be placed before the command that calls the function. Although not a requirement, most programmers place the function definitions between the <HEAD> and </HEAD> tags. You're now going to start creating a function called XmasDays, which will calculate the number of days remaining until Christmas, given the current date.

Before creating the function, consider how to calculate the number of days remaining until Christmas. Again, we are going to assume that todays date is October 15th. The first thing we will do is calculate this date against the 25th. The mathematical formula used would be (25-15). You must also add the number of days in October and November to the total. October has 31 days, and November has 30 days. This means that the number of days between October 15th and December 25th is:

(25-15) + 31 + 30=10 + 61 = 71 days

Your simple version of the XmasDays function will handle only dates in October. Notice in the code below you will add the comment (which is seen after the //) "this function calculates the number of days until Christmas," which performs no task other than to let you know what the function does. You will place this code after your title tag in your heading section of your document and just above the ending head tag (</HEAD>. The code for this reduced function is as follows:

<SCRIPT LANGUAGE="JavaScript">

<!--Hide from non-JavaScript browsers

//This function calculates the number of days until Christmas

function XmasDays(Month, Day, Year) {

var DayCount=(25-Day) + 31 + 30;

return DayCount;

}

//Stop hiding-->

</Script>

 

Now you must call the XmasDays function. Scroll down to the line "var DaysLeft=999;" and replace this line with:

var DaysLeft=XmasDays(ThisMonth, ThisDay, ThisYear);

Creating Arrays

In the above version of the XmasDays function, you were limited to working with a single month, October. However, your clients want this function to work for any month. For this to happen, you need a variable that can store multiple values. This variable will need to store the number of days in each of the 12 months of the year. This type of variable is called an array. You will now create an array named "MonthCount." You will use values from the array in the XmasDays function to calculate the days remaining until Christmas.

An array is an ordered collection of values referenced by a single variable name. The syntax for creating an array variable is:

var Month = new Array();

Month[12]="December";

Return to your text editor. Below the function statement "function XmasDays(Month, Day, Year) {," insert the following lines (indented to make your program easier to read):

var MonthCount=new Array();

MonthCount[1]=31;

MonthCount[2]=28;

MonthCount[3]=31;

MonthCount[4]=30;

MonthCount[5]=31;

MonthCount[6]=30;

MonthCount[7]=31;

MonthCount[8]=31;

MonthCount[9]=30;

MonthCount[10]=31;

MonthCount[11]=30;

Edit the line that reads "var DayCount=(25-Day) + 31 + 30" to read:

var DayCount=(25-Day) + MonthCount[10] + MonthCount[11];

Working with Loops

Up to now each line of code in your JavaScript program has been run just once. You need to create a code that runs this JavaScript an indeterminate number of times. To provide the program with this capability, you must use a program loop. A loop is a set of instructions that is executed repeatedly. There are two types of loops: loops that repeat a set number of times before quitting, and loops that repeat until a certain condition is met. You will create the first type using a For statement.

The For loop allows you to create a group of commands that will react like a counter, tracking the number of times the command block has run. The general syntax of the For loop is:

for(start; stop; update) {

JavaScript Commands

}

where start is the starting value of the counter, stop is the ending value of the counter or the condition under which the loop quits, and update specifies how the counter changes in value each time the command block is executed. The command block in the For loop is set off by curly braces {}. For more information on For loop commands, refer to pages 7.31-7.32 in your textbook.

The Wile loop runs a command group as long as a specific condition is met. The general syntax of the While loop is:

while(condition) {

JavaScript Commands

}

where condition is an expression using logical or comparison operators that can be either true or false. As long as the condition is true, the group of statements will be executed by JavaScript.

With an brief understanding of program loops (for a more extensive explanation, see tutorial 7 in your textbook), you are ready to modify the Xmas/days function so that is works for any day of the year. Find the line that reads MonthCount[11]=30; and insert a blank line under it and type the following:

var MonthTotal=0

for (i=Month;i<12;i++) {

MonthTotal = MonthTotal+MonthCount[i];

}

Change the line: var DayCount = (25 - Day) + MonthCount[10] + MonthCount[11]; to:

var DayCount = (25 - Day) + MonthTotal;

Using the If Statement

The If statement has the following general syntax:

if(condition){

JavaScript Commands

}

where condition is an expression that is either true or false.

For leap year, an expression should be entered so that the value returned is not one day off. Below the line:

"MonthCount[11]=30;" insert the following lines (indented to make your code easier to follow):

if(Year % 4 == 0) {

MonthCount[2]=29;

}

Using the If...Else Statement

The If statement you just entered runs a set of commands if the condition is true, but does nothing if the condition is false. Sometimes you want the If statement to run one set of commands if the condition is true and another set of commands if the condition is false. An If...Else statement allows you to do this. The syntax for this statement is:

if(condition){

JavaScript Commands if true

} else {

JavaScript Commands if false

}

where condition is an expression that is either true of false, and one set of commands is run if the expression is true, and another is run if the expression is false. You will use this command to display a message from December 25th or later (through December 31st), otherwise it will display the number of days until Christmas as calculated by the XmasDays function.

You will distinguish between the two situations by creating an If...Else statement that looks at the value returned by the XmasDays function. If that value is positive, then the current date is before December 25th, and the page should display the number of days left in the holiday season. On the other hand, if the value is 0 or negative, then the current date is December 25th of later in the year, and a holiday message should be generated. The code to perform this is as follows:

if(DaysLeft > 0) {

document.write("Only " + DaysLeft + " days until Christmas";

} else {

document.write("Have a Wild and Wacky Holiday from Just Plain Stupid!"

}

Replace the line "document.write("Only " + DaysLeft + " days until Christmas");" with:

//Display either the number of days until Christmas, or a holiday greeting

if(DaysLeft > 0) {

document.write("Only " + DaysLeft + " days until Christmas");

} else {

document.write("Have a Wild and Wacky Holiday from Just Plain Stupid!");

}

Save your changes and then reopen it in your Web browser. The page should display the "only so many days until Christmas. Change your date to December 26 and resave it. Display it in your browser. It should now show your holiday greeting.

The last thing you want to do is change the line "var Today=new Date("December 26, 2001"); to:

var Today = new Date();

This will now display todays date and will change the date each day.

Congratulations on completing your first Web page!!! You are not a Web Master yet, but you are well on your way!!!!!