Chapter: Internet & World Wide Web HOW TO PROGRAM - The Ajax Client - Introduction to XHTML

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

Linking - XHTML

One of the most important XHTML features is the hyperlink, which references (or links to) other resources, such as XHTML documents and images.

Linking

 

One of the most important XHTML features is the hyperlink, which references (or links to) other resources, such as XHTML documents and images. When a user clicks a hyper-link, the browser tries to execute an action associated with it (e.g., navigate to a URL, open an e-mail client, etc.). In XHTML, both text and images can act as hyperlinks. Web browsers typically underline text hyperlinks and color their text blue by default, so that users can distinguish hyperlinks from plain text. In Fig. 4.3, we create text hyperlinks to four different websites.

 

Line 14 introduces the strong element, which indicates that its contents has high importance. Browsers typically display such text in a bold font.

 

Links are created using the a (anchor) element. Line 17 defines a hyperlink to the URL assigned to attribute href, which specifies the location of a linked resource, such as

<?xml version = "1.0" encoding = "utf-8"?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- Fig. 4.3: links.html -->

 

<!-- Linking to other web pages. -->

<html xmlns = "http://www.w3.org/1999/xhtml">

 

<head>

 

<title>Links</title>

 

</head>

<body>

<h1>Here are my favorite sites</h1>

 

<p><strong>Click a name to go to that page.</strong></p>

 

<!-- Create four text hyperlinks -->

 

<p><a href = "http://www.deitel.com">Deitel</a></p>

 

<p><a href = "http://www.prenhall.com">Prentice Hall</a></p>

 

<p><a href = "http://www.yahoo.com">Yahoo!</a></p>

 

<p><a href = "http://www.usatoday.com">USA Today</a></p>

 

</body>

 

</html>


a web page, a file or an e-mail address. This particular anchor element links the text Deitel to a web page located at http://www.deitel.com. When a URL does not indicate a spe-cific document on the website, the web server returns a default web page. This page is often called index.html; however, most web servers can be configured to use any file as the default web page for the site. If the web server cannot locate a requested document, it returns an error indication to the web browser, and the browser displays a web page con-taining an error message to the user.

Hyperlinking to an E-Mail Address

 

Anchors can link to e-mail addresses using a mailto: URL. When someone clicks this type of anchored link, most browsers launch the default e-mail program (e.g., Microsoft Out-look or Mozilla Thunderbird) to enable the user to write an e-mail message to the linked address. Figure 4.4 demonstrates this type of anchor. Lines 15–17 contain an e-mail link. The form of an e-mail anchor is <a href = "mailto:emailAddress"></a>. In this case, we link to the e-mail address deitel@deitel.com.

 <?xml version = "1.0" encoding = "utf-8"?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

<!-- Fig. 4.4: contact.html -->

 

<!-- Linking to an e-mail address. -->

 

<html xmlns = "http://www.w3.org/1999/xhtml">

 

<head>

 

<title>Contact Page</title>

 

</head>

<body>

<p>

 

My email address is

 

<a href = "mailto:deitel@deitel.com">

deitel@deitel.com

</a>

 

. Click the address and your default email client

 

will open an e-mail message and address it to me.

</p>

 

</body>

 

</html>

 




Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.