Chapter 5 Introduction to XHTML Part 2 Outline

  • Slides: 34
Download presentation
Chapter 5 - Introduction to XHTML: Part 2 Outline 5. 1 5. 2 5.

Chapter 5 - Introduction to XHTML: Part 2 Outline 5. 1 5. 2 5. 3 5. 4 5. 5 5. 6 5. 7 5. 8 5. 9 5. 10 5. 11 Introduction Basic XHTML Tables Intermediate XHTML Tables and Formatting Basic XHTML Forms More Complex XHTML Forms Internal Linking Creating and Using Image Maps <meta> Tags frameset Element Nested framesets Internet and World Wide Web Resources 2001 Prentice Hall, Inc. All rights reserved. 1

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Outline <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> <!-- Fig. 5. 1: table 1. html <!-- Creating a basic table --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>A simple XHTML table</title> </head> The border attribute gives the size in pixels of the table’s border. The width attribute gives the width of the table. <body> <!-- The <table> tag opens a table --> <table border = "1" width = "40%" summary = "This table provides information about the price of fruit"> Table 1. html The summary attribute --> describes the table’s contents. <!-- The <caption> tag summarizes the table's <!-- contents (this helps the visually impaired) --> <caption><strong>Price of Fruit</strong></caption> <!-- The <thead> is the first section of a --> <!-- table. It formats the table header --> <!-- area. <th> inserts a heading cell. --> <thead> <tr> Text placed in a table header is <th>Fruit</th> <th>Price</th> rendered bold and centered in the cell. </tr> </thead> 2001 Prentice Hall, Inc. All rights reserved. 2

33 34 35 36 37 38 39 40 41 42 43 44 45 46

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 <!-- All table content goes is enclosed within <!-- <tbody>. <tr> inserts a table row. <td> <!-- inserts a data cell. <tbody> <tr> <td>Apple</td> <td>$0. 25</td> </tr> <td>Orange</td> <td>$0. 50</td> </tr> <td>Banana</td> <td>$1. 00</td> </tr> <td>Pineapple</td> <td>$2. 00</td> </tr> </tbody> <tfoot> <tr> <th>Total</th> <th>$3. 75</th> </tr> </tfoot> </table> --> --> Outline The body of the table is placed between the tbody tags. Table rows are created using the tr element Table 1. html Data placed between td tags are placed in an individual cell. The table footer belongs at the bottom of the table. It formats text in a similar manner to a table header. 2001 Prentice Hall, Inc. All rights reserved. 3

67 68 69 Outline </body> </html> Table Caption Table 1. html Table header Program

67 68 69 Outline </body> </html> Table Caption Table 1. html Table header Program Output Start of table body End of table body Table footer 2001 Prentice Hall, Inc. All rights reserved. 4

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Outline <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> <!-- Fig. 5. 2: table 2. html --> <!-- Intermediate table design --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Tables </title> </head> <body> <h 1>Table Example Page</h 1> <table border = "1"> <caption>Here is a more complex sample table. </caption> <!-- <colgroup> and <col> are used to <!-- format entire columns at once. <!-- span determines how many columns <!-- the col tag affects. <colgroup> <col align = "right" span = "1" /> </colgroup> <thead> --> --> Table 2. html The span attribute indicates width of the data cell in number of columns. The align attribute is used to horizontally align data in a cell. 2001 Prentice Hall, Inc. All rights reserved. 5

30 31 32 33 34 35 36 37 38 39 40 41 42 43

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 <!-- rowspans and colspans merge the specified <!-- number of cells vertically or horizontally <tr> --> Outline Table 2. html <!-- Merge two rows --> <th rowspan = "2"> <img src = "camel. gif" width = "205" height = "167" alt = "Picture. The of value a camel" of the/>colspan attribute gives </th> the amount of columns taken up by the cell. <!-- Merge four columns --> <th colspan = "4" valign = "top"> <h 1>Camelid comparison</h 1> <p>Approximate as of 8/99</p> The vertical alignment of data in a cell can </th> </tr> be specified with the valign attribute. <tr valign = "bottom"> <th># of Humps</th> <th>Indigenous region</th> <th>Spits? </th> <th>Produces Wool? </th> </tr> </thead> <tbody> <tr> <th>Camels (bactrian)</th> <td>2</td> <td>Africa/Asia</td> <td rowspan = "2">Llama</td> </tr> The value of the rowspan attribute gives the amount of rows taken up by the cell. 2001 Prentice Hall, Inc. All rights reserved. 6

65 66 67 68 69 70 71 72 73 74 75 76 77 <tr>

65 66 67 68 69 70 71 72 73 74 75 76 77 <tr> <th>Llamas</th> <td>1</td> <td>Andes Mountains</td> </tr> Outline </tbody> </table> </body> </html> Table 2. html Cell spanning the size of two rows. Cell spanning the size of four columns. Program Output 2001 Prentice Hall, Inc. All rights reserved. 7

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 Outline <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> <!-- Fig. 5. 3: form. html --> <!-- Form Design Example 1 --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Forms </title> </head> The method attribute specifies how the form’s data is sent to the Web server. The post method appends form data to the browser request. <body> <h 1>Feedback Form</h 1> <p>Please fill out this form to help us improve our site. </p> <!-- This tag starts the form, gives the method of <!-- sending information and the location of form <!-- scripts. Hidden inputs contain <!-- non-visual information <form method = "post" action = "/cgi-bin/formmail"> <p> Each form must begin and end with form tags. --> --> Form. html The value of the action attribute specifies the URL of a script on the Web server. Input elements are used to send data to the script that processes the form. <input type = "hidden" name = "recipient" value = "deitel@deitel. com" /> <input type = "hidden" name = "subject" value = "Feedback Form" /> <input type = "hidden" name = "redirect" value = "main. html" /> </p> A hidden value for the type attribute sends data that is not entered by the user. 2001 Prentice Hall, Inc. All rights reserved. 8

34 35 36 37 38 39 40 41 42 43 44 45 46 47

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 <!-- <input type = "text"> inserts a text box --> <p><label>Name: <input name = "name" type = "text" size = "25" maxlength = "30" /> </label></p> <p> Outline The size attribute gives the number of characters visible in the text box. <!-- input types "submit" and "reset" insert --> <!-- buttons for submitting and clearing the --> <!-- form's contents --> <input type = "submit" value = The maxlength attribute gives the maximum "Submit Your Entries" /> number of characters the user can input. <input type = "reset" value = "Clear Your Entries" /> </p> </form> </body> </html> Form. html The value attribute displays a name on the buttons created. The label element describes the data the user needs to enter in the text box. 2001 Prentice Hall, Inc. All rights reserved. 9

Outline Text box created using input element. Program Output Submit button created using input

Outline Text box created using input element. Program Output Submit button created using input element. Reset button created using input element. 2001 Prentice Hall, Inc. All rights reserved. 10

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> Outline <!-- Fig. 5. 4: form 2. html --> <!-- Form Design Example 2 --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Forms </title> </head> <body> <h 1>Feedback Form</h 1> <p>Please fill out this form to help us improve our site. </p> Form 2. html <form method = "post" action = "/cgi-bin/formmail"> <p> <input type = "hidden" name = "recipient" value = "deitel@deitel. com" /> <input type = "hidden" name = "subject" value = "Feedback Form" /> <input type = "hidden" name = "redirect" value = "main. html" /> </p> <p><label>Name: <input name = "name" type = "text" size = "25" /> </label></p> 2001 Prentice Hall, Inc. All rights reserved. 11

35 36 37 38 39 40 41 42 43 44 45 46 47 48

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 <!-- <textarea> creates a multiline textbox --> <p><label>Comments: <textarea name = "comments" rows = "4" cols = "36"> Enter your comments here. </textarea> </label></p> Outline The textarea element renders a text area when the page is displayed. The size of the text area can be specified with the rows and cols attribute. <!-- <input type = "password"> inserts a --> <!-- textbox whose display is masked with --> <!-- asterisk characters --> <p><label>E-mail Address: <input name = "email" type = "password" size = "25" /> Setting </label></p> an input element’s type attribute to checkbox will create a checkbox. <p> <strong>Things you liked: </strong> <label>Site design <input name = "thingsliked" type = "checkbox" value = "Design" /></label> <label>Links <input name = "thingsliked" type = "checkbox" value = "Links" /></label> Form 2. html Checkboxes that belong to the same group must have same value in the name attribute. <label>Ease of use <input name = "thingsliked" type = "checkbox" value = "Ease" /></label> <label>Images <input name = "thingsliked" type = "checkbox" value = "Images" /></label> 2001 Prentice Hall, Inc. All rights reserved. 12

69 70 71 72 73 74 75 76 77 78 79 80 81 82

69 70 71 72 73 74 75 76 77 78 79 80 81 82 Outline <label>Source code <input name = "thingsliked" type = "checkbox" value = "Code" /></label> </p> <input type = "submit" value = "Submit Your Entries" /> <input type = "reset" value = "Clear Your Entries" /> </p> </form> </body> </html> Form 2. html Text area created with input element. Program Output Checkbox options created with input element. 2001 Prentice Hall, Inc. All rights reserved. 13

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> Outline <!-- Fig. 5. 5: form 3. html --> <!-- Form Design Example 3 --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Forms </title> </head> <body> <h 1>Feedback Form</h 1> <p>Please fill out this form to help us improve our site. </p> Form 3. html <form method = "post" action = "/cgi-bin/formmail"> <p> <input type = "hidden" name = "recipient" value = "deitel@deitel. com" /> <input type = "hidden" name = "subject" value = "Feedback Form" /> <input type = "hidden" name = "redirect" value = "main. html" /> </p> <p><label>Name: <input name = "name" type = "text" size = "25" /> </label></p> 2001 Prentice Hall, Inc. All rights reserved. 14

35 36 37 38 39 40 41 42 43 44 45 46 47 48

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 <p><label>Comments: <textarea name = "comments" rows = "4" cols = "36"></textarea> </label></p> Outline <p><label>E-mail Address: <input name = "email" type = "password" size = "25" /></label></p> <strong>Things you liked: </strong> <label>Site design <input name = "things" type = "checkbox" value = "Design" /></label> <label>Links <input name = "things" type = "checkbox" value = "Links" /></label> Form 3. html <label>Ease of use <input name = "things" type = "checkbox" value = "Ease" /></label> <label>Images <input name = "things" type = "checkbox" value = "Images" /></label> <label>Source code <input name = "things" type = "checkbox" value = "Code" /></label> </p> 2001 Prentice Hall, Inc. All rights reserved. 15

68 69 70 71 72 73 74 75 76 77 78 79 80 81

68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 <!-- <input type = "radio" /> creates a radio --> <!-- button. The difference between radio buttons --> <!-- and checkboxes is that only one radio button --> <!-- in a group can be selected --> <p> <strong>How did you get to our site? : </strong> <label>Search engine <input name = "how get to site" type = "radio" value = "search engine" checked = "checked" /> </label> <label>Links from another site <input name = "how get to site" type = "radio" value = "link" /></label> <label>Deitel. com Web site <input name = "how get to site" type = "radio" value = "deitel. com" /></label> <label>Reference in a book <input name = "how get to site" type = "radio" value = "book" /></label> <label>Other <input name = "how get to site" type = "radio" value = "other" /></label> Outline 16 The checked attribute will mark this radio option by default. Form 3. html An input element with type value equal to radio creates radio buttons. </p> 2001 Prentice Hall, Inc. All rights reserved.

98 99 100 101 102 103 104 105 106 107 108 109 110 111

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 Outline <p> <label>Rate our site: <!-- The <select> tag presents a drop-down --> <!-- list with choices indicated by the --> <!-- <option> tags --> <select name = "rating"> <option selected = "selected">Amazing</option> <option>10</option> <option>9</option> <option>8</option> The select element <option>7</option> creates a drop down list. <option>6</option> <option>5</option> <option>4</option> <option>3</option> <option>2</option> The selected attribute selects a <option>1</option> default value for the drop down list. Form 3. html <option>Awful</option> </select> </label> </p> <p> The option tag is used for each option in the drop down list. <input type = "submit" value = "Submit Your Entries" /> <input type = "reset" value = "Clear Your Entries" /> </p> </form> </body> </html> 2001 Prentice Hall, Inc. All rights reserved. 17

Outline Output Radio. Program box list created with input element. Drop down box list

Outline Output Radio. Program box list created with input element. Drop down box list created with input element. The Amazing option is selected as a default value. 2001 Prentice Hall, Inc. All rights reserved. 18

Outline Program Output 2001 Prentice Hall, Inc. All rights reserved. 19

Outline Program Output 2001 Prentice Hall, Inc. All rights reserved. 19

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Outline <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> <!-- Fig. 5. 6: links. html --> <!-- Internal Linking --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - List </title> </head> To internally link, place a # sign in front of the name of the desired anchor element within the page. <body> <!-- <a name = ". . "></a> creates an internal hyperlink --> <p><a name = "features"></a></p> <h 1>The Best Features of the Internet </h 1> <!-- An internal link's address is "# linkname" --> <p><a href = "#ceos">Go to <em>Favorite CEOs</em></a></p> Links. html <ul> <li>You can meet people from countries around the world. </li> <li>You have access to new media as it becomes public: <ul> <li>New games</li> <li>New applications <ul> <li>For Business</li> <li>For Pleasure</li> </ul> </li> 2001 Prentice Hall, Inc. All rights reserved. 20

36 37 38 39 40 41 42 43 44 45 46 47 48 49

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 <li>Around the clock news</li> <li>Search Engines</li> <li>Shopping</li> <li>Programming <ul> <li>XHTML</li> <li>Java</li> <li>Dynamic HTML</li> <li>Scripts</li> <li>New languages</li> </ul> </li> <li>Links</li> <li>Keeping in touch with old friends </li> <li>It is the technology of the future! </li> </ul> <!-- Named anchor --> <p><a name = "ceos"></a></p> <h 1>My 3 Favorite <em>CEOs</em></h 1> Outline An anchor named ceos will be created at this point on the page. This anchor does not link and will not be seen on the page. Links. html However, other anchors can refer to this anchor and link to it. <p> <!-- Internal hyperlink to features --> <a href = "#features">Go to <em>Favorite Features</em> </a></p> 2001 Prentice Hall, Inc. All rights reserved. 21

66 67 68 69 70 71 72 73 <ol> <li>Bill Gates</li> <li>Steve Jobs</li> <li>Michael

66 67 68 69 70 71 72 73 <ol> <li>Bill Gates</li> <li>Steve Jobs</li> <li>Michael Dell</li> </ol> Outline </body> </html> Links. html Clicking on this internal link will bring the user to the bottom of the page where My 3 Program Output Favorite CEOs is located. 2001 Prentice Hall, Inc. All rights reserved. 22

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 <? xml version = "1. 0" ? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> Outline <!-- Fig. 5. 7: picture. html --> <!-- Creating and Using Image Maps --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title> Internet and WWW How to Program - Image Map </title> </head> The area element is used to create hotspots. <body> <p> <!-- The <map> tag defines an image map --> <map id = "picture"> The shape attribute defines a shape. Picture. html for the hotspot. <!-- The "shape = rect" indicates a rectangular --> The first two integers of the <!-- area, with coordinates for the upper-left --> coordinate attribute define the (x, y) <!-- and lower-right corners --> <area href = "form. html" shape = "rect" coordinate of the upper-left hand coords = "2, 123, 54, 143" corner of the rectangle. alt = "Go to the feedback form" /> The last two integers define the (x, y) <area href = "contact. html" shape = "rect" coords = "126, 122, 198, 143" coordinate of the lower-right hand alt = "Go to the contact page" /> corner of the rectangle. <area href = "main. html" shape = "rect" coords = "3, 7, 61, 25" alt = "Go to the homepage" /> <area href = "links. html" shape = "rect" coords = "168, 5, 197, 25" 2001 Prentice Hall, Inc. alt = "Go to the links page" /> All rights reserved. 23

36 37 38 39 40 41 42 43 44 45 46 47 48 49

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 <!-- Value poly creates a hotspot in the shape --> <!-- of a polygon, defined by coords --> <area shape = "poly" alt = "E-mail the Deitels" coords = "162, 25, 154, 39, 158, 54, 169, 51, 183, 39, 161, 26" href = "mailto: deitel@deitel. com" /> <!-- The "shape = circle" indicates a circular <!-- area with center and radius listed <area href = "mailto: deitel@deitel. com" shape = "circle" coords = "100, 36, 33" alt = "E-mail the Deitels" /> </map> --> Outline Assigning poly to the shape attribute creates a polygon with coordinates defined by the coords attribute. <!-- <img src =. . . usemap = "#id"> indicates that the --> Assigning circle to the shape <!-- indicated image map is used with this image --> attribute creates a circle, with <img src = "deitel. gif" width = "200" height = "144" a center and radius specified alt = "Deitel logo" usemap = "#picture" /> Picture. html by the coords attribute. </p> </body> </html> The image map assigned to the usemap attribute will be used with the image. The # in front of the name of the image map indicates that an internal image map is being used. 2001 Prentice Hall, Inc. All rights reserved. 24

Outline Selecting the Feedback hotspot links to the page below. Hotspots created using the

Outline Selecting the Feedback hotspot links to the page below. Hotspots created using the area element. Program Output 2001 Prentice Hall, Inc. All rights reserved. 25

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Outline <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Strict//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -strict. dtd"> <!-- Fig. 5. 8: main. html --> <!-- <meta> tag --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Welcome </title> <!-- <meta> tags give search engines information --> <!-- they need to catalog your site --> <meta name = "keywords" content = "Webpage, design, XHTML, tutorial, personal, help, index, form, contact, feedback, list, links, frame, deitel" /> The name attribute describes the type of meta element. <meta name = "description" content = "This Web site will help you learn the basics of XHTML and Webpage design through the use of interactive examples and instruction. " /> </head> <body> The meta element provides information to search engines about the document. Main. html The content attribute provides the information search engines use to catalog pages. <h 1>Welcome to Our Web Site! </h 1> <p>We have designed this site to teach about the wonders of <strong><em>XHTML</em></strong>. <em>XHTML</em> is better equipped than <em>HTML</em> to represent complex data on the Internet. <em>XHTML</em> takes advantage of XML’s strict syntax to ensure well- formedness. Soon you will know about many of the great new features of <em>XHTML. </em></p> 2001 Prentice Hall, Inc. All rights reserved. 26

36 37 38 39 40 <p>Have Fun With the Site!</p> Outline </body> </html> Main.

36 37 38 39 40 <p>Have Fun With the Site!</p> Outline </body> </html> Main. html 2001 Prentice Hall, Inc. All rights reserved. 27

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Frameset//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -frameset. dtd"> <!-- Fig. 5. 9: index. html --> <!-- XHTML Frames I --> Outline The frameset element informs the browser that the page contains frames. <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Main </title> <meta name = "keywords" content = "Webpage, design, XHTML, tutorial, personal, help, index, form, contact, feedback, list, links, frame, deitel" /> <meta name = "description" content = "This Web site will help you learn the basics of XHTML and Web page design through the use of interactive examples The cols and instruction. " /> </head> <!-- The <frameset> tag sets the frame dimensions <frameset cols = "110, *"> attribute gives the width of Index. html each frame. The first vertical frame created is 110 pixels from the left of the browser. The second vertical --> frame fills the rest of the browser, as indicated by the * value. <!-- Individual frame elements specify which pages --> <!-- appear in a given frame --> <frame name = “leftframe" src = "nav. html" /> <frame name = "main" src = "main. html" /> The frame element loads documents into the frameset. The src attribute indicates the document to be loaded. Nav. html is loaded into the left frame and main. html is loaded into the right frame. 2001 Prentice Hall, Inc. All rights reserved. 28

30 31 32 33 34 35 36 37 38 39 <noframes> <p>This page uses

30 31 32 33 34 35 36 37 38 39 <noframes> <p>This page uses frames, but your browser does not support them. </p> Outline <p>Please, <a href = "nav. html">follow this link to browse our site without frames </a>. </p> </noframes> </frameset> </html> Left frame (leftframe) The noframes element provides an option for browsers that do not display frames. Right frame (main) Index. html 2001 Prentice Hall, Inc. All rights reserved. 29

Outline When Header Examples is selected, the document it links to is displayed in

Outline When Header Examples is selected, the document it links to is displayed in the right frame. Program Output 2001 Prentice Hall, Inc. All rights reserved. 30

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Transitional//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -transitional. dtd"> Outline <!-- Fig. 5. 10: nav. html --> <!-- Using images as link anchors --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Navigation Bar </title> </head> <body> The target attribute specifies where the document linked by the anchor should display. <p> <a href = "links. html" target = "main"> <img src = "buttons/links. jpg" width = "65" height = "50" alt = "Links Page" /> </a> <a href = "list. html" target = "main"> <img src = "buttons/list. jpg" width = "65" height = "50" alt = "List Example Page" /> </a> Nav. html The document will open in the frame called main. <a href = "contact. html" target = "main"> <img src = "buttons/contact. jpg" width = "65" height = "50" alt = "Contact Page" /> </a> 2001 Prentice Hall, Inc. All rights reserved. 31

33 34 35 36 37 38 39 40 41 42 43 44 45 46

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 <a href = "header. html" target = "main"> <img src = "buttons/header. jpg" width = "65" height = "50" alt = "Header Page" /> </a> Outline <a href = "table 1. html" target = "main"> <img src = "buttons/table. jpg" width = "65" height = "50" alt = "Table Page" /> </a> <a href = "form. html" target = "main"> <img src = "buttons/form. jpg" width = "65" height = "50" alt = "Feedback Form" /> </a> </p> </body> </html> Nav. html Other values of target can be specified to load documents onto a new browser window, into the same frame that the anchor appears in and onto a full browser window, removing all frames. 2001 Prentice Hall, Inc. All rights reserved. 32

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 <? xml version = "1. 0"? > <!DOCTYPE html PUBLIC "-//W 3 C//DTD XHTML 1. 0 Frameset//EN" "http: //www. w 3. org/TR/xhtml 1/DTD/xhtml 1 -frameset. dtd"> Outline <!-- Fig. 5. 11: index 2. html --> <!-- XHTML Frames II --> <html xmlns = "http: //www. w 3. org/1999/ xhtml"> <head> <title>Internet and WWW How to Program - Main </title> The vertical frame on the right is into two horizontal frames. <meta name = "keywords" content = "Webpage, design, divided XHTML, tutorial, personal, help, index, form, contact, feedback, list, links, frame, deitel" /> <meta name = "description" content = "This Web site will help you learn the basics of XHTML and Web page design through the use of interactive examples and instruction. " /> </head> <frameset cols = "110, *"> <frame name = "nav" src = "nav. html" /> Index 2. html The rows attribute works in a similar manner to the cols attribute, except the rows attribute gives the height of each frame. <!-- Nested framesets are used to change the --> <!-- formatting and spacing of the frameset --> <!-- as a whole --> <frameset rows = "175, *"> <frame name = "picture" src = "picture. html" /> <frame name = "main" src = "main. html" /> </frameset> 2001 Prentice Hall, Inc. All rights reserved. 33

34 35 36 37 38 39 40 41 42 43 <noframes> <p>This page uses

34 35 36 37 38 39 40 41 42 43 <noframes> <p>This page uses frames, but your browser does not support them. </p> Outline <p>Please, <a href = "nav. html">follow this link to browse our site without frames </a>. </p> </noframes> </frameset> </html> Index 2. html The nested frame element splits the right vertical frame into two horizontal frames. Program Output 2001 Prentice Hall, Inc. All rights reserved. 34