G.6. Internal Linking

In Appendix F, we discussed how to hyperlink one Web page to another. Figure G.6 introduces internal linkinga mechanism that enables the user to jump between locations in the same document. Internal linking is useful for long documents that contain many sections. Clicking an internal link enables users to find a section without scrolling through the entire document.

Figure G.6. Internal hyperlinks to make pages more navigable.

 1  "1.0"?>
 2  "-//W3C//DTD XHTML 1.1//EN"
 3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 4
 5 
 6 
 7
 8 
"http://www.w3.org/1999/xhtml"> 9 10 Internet and WWW How to Program - List 11 12 13 14 15 16

"features">The Best Features of the Internet

17 18 19

<a href="</span">"#bugs">Go to Favorite Bugs</a>

20 21
  • 22
    • You can meet people from countries 23 around the world.
    • 24 25
      • You have access to new media as it becomes public: 26
        • 27
          • New games
          • 28
            • New applications 29
              • 30
                • For Business
                • 31
                  • For Pleasure
                  • 32
                  33
                • 34 35
                  • Around the clock news
                  • 36
                    • Search Engines
                    • 37
                      • Shopping
                      • 38
                        • Programming 39
                          • 40
                            • XHTML
                            • 41
                              • Java
                              • 42
                                • Dynamic HTML
                                • 43
                                  • Scripts
                                  44
                                  • New languages
                                  • 45
                                  46
                                • 47
                                48
                              • 49 50
                                • Links
                                • 51
                                  • Keeping in touch with old friends
                                  • 52
                                    • It is the technology of the future!
                                    • 53
                                    54 55 56

                                    "bugs">My 3 Favorite Bugs

                                    57 58

                                    59 60 61 <a href="</span"> "#features">Go to Favorite Features</a><a href="</span"> 62 </a>

                                    63 64
                                    1. 65
                                      • Fire Fly
                                      • 66
                                        • Gal Ant
                                        • 67
                                          • Roman Tic
                                          • 68
                                    69 70 71

Line 16 contains a tag with the id attribute (called "features") for an internal hyperlink. To link to a tag with this attribute inside the same Web page, the href attribute of an anchor element includes the id attribute value preceded by a pound sign (as in #features). Lines 6162 contain a hyperlink with the id features as its target. Selecting this hyperlink in a Web browser scrolls the browser window to the h1 tag in line 16.

Look and Feel Observation G 2

Internal hyperlinks are useful in XHTML documents that contain large amounts of information. Internal links to different parts of the page makes it easier for users to navigate the page. They do not have to scroll to find the section they want.

 

Although not demonstrated in this example, a hyperlink can specify an internal link in another document by specifying the document name followed by a pound sign and the id value, as in:

href = "filename.html#id"

 

For example, to link to a tag with the id attribute called booklist in books.html, href is assigned "books.html#booklist".

Preface

Index

    Introduction to Computers, the Internet and Visual C#

    Introduction to the Visual C# 2005 Express Edition IDE

    Introduction to C# Applications

    Introduction to Classes and Objects

    Control Statements: Part 1

    Control Statements: Part 2

    Methods: A Deeper Look

    Arrays

    Classes and Objects: A Deeper Look

    Object-Oriented Programming: Inheritance

    Polymorphism, Interfaces & Operator Overloading

    Exception Handling

    Graphical User Interface Concepts: Part 1

    Graphical User Interface Concepts: Part 2

    Multithreading

    Strings, Characters and Regular Expressions

    Graphics and Multimedia

    Files and Streams

    Extensible Markup Language (XML)

    Database, SQL and ADO.NET

    ASP.NET 2.0, Web Forms and Web Controls

    Web Services

    Networking: Streams-Based Sockets and Datagrams

    Searching and Sorting

    Data Structures

    Generics

    Collections

    Appendix A. Operator Precedence Chart

    Appendix B. Number Systems

    Appendix C. Using the Visual Studio 2005 Debugger

    Appendix D. ASCII Character Set

    Appendix E. Unicode®

    Appendix F. Introduction to XHTML: Part 1

    Appendix G. Introduction to XHTML: Part 2

    Appendix H. HTML/XHTML Special Characters

    Appendix I. HTML/XHTML Colors

    Appendix J. ATM Case Study Code

    Appendix K. UML 2: Additional Diagram Types

    Appendix L. Simple Types

    Index



    Visual C# How to Program
    Visual C# 2005 How to Program (2nd Edition)
    ISBN: 0131525239
    EAN: 2147483647
    Year: 2004
    Pages: 600

    Flylib.com © 2008-2020.
    If you may any questions please contact us: flylib@qtcs.net