JavaScript EditorDebugger script     Dhtml css 



Team LiB
Previous Section Next Section

Creating an Address Block

The address block is used to identify the author or owner of the page and can provide a way for a visitor to provide feedback. It is conventional to place the address block at the bottom of the page, following the page's content. Nothing in the HTML specifications requires that, however—you are free to place your address block at the top of the page, although that is seldom done.

Adding a Horizontal Rule

It is conventional to separate the address block from the rest of the page using a horizontal rule. Use the HR (Horizontal Rule) element to insert a horizontal rule at the bottom of the page (see Figure 2.11):

</ul>
</center>
<hr>
</body>
Click To expand
Figure 2.11: The HR element draws a horizontal rule across the page.

Using the ADDRESS Element

Whereas the HR element is used to visually separate the rest of the page from the address block, the ADDRESS element is used to create the actual address block. The address block generally includes information that identifies the author or owner of a page. Create an address block that identifies the author of the page (see Figure 2.12):

<hr>
<address>
Miranda Jones
</address>
</body>
Click To expand
Figure 2.12: The address block identifies the author or owner of a page.

As you will notice in Figure 2.12, the content of the ADDRESS element is generally displayed in an italic font. Nothing in the HTML specifications requires this, however. Early versions of Internet Explorer, for instance, do not italicize the ADDRESS element. To make sure that your address block content is italicized in all browsers, just bracket it with an I (Italic) element:

<hr>
<address>
<i>
Miranda Jones
</i>
</address>
</body>

Adding a Line Break

You can use the BR (Break) element to add a line break within the address block. Insert a line break following Miranda Jones' name, followed by her e-mail address (see Figure 2.13):

<hr>
<address>
<i>
Miranda Jones<br>
E-Mail: miranda@mirandas-world.com
</i>
</address>
</body>
Click To expand
Figure 2.13: The BR element adds a line break.

FIND IT ONLINE
According to the HTML specifications, block elements are not permitted within an ADDRESS element, but only text and inline elements. Thus, you shouldn't use P elements inside of the ADDRESS element to create vertical separation between lines. If you do, browsers generally won't care, but the W3C's HTML Validator (at validator.w3.org/) will report an error if you try to validate your page. A browser may also report an error if you have turned on any error-checking or validation routines it provides.

Tip 

The HTML 4.01 specification does not allow the use of the ALIGN attribute with the ADDRESS element, although browsers do allow it. To create a valid HTML 4.01 page, you can center an address element by nesting it inside of a CENTER element. To right-align it, you can nest the ADDRESS element inside of a right-aligned DIV element.

Adding an E-Mail Link

To create a link to an e-mail address, you need to create a special form of link—a mailto link. Set up Miranda Jones' e-mail address so a user can click on it to send her an e-mail message (see Figure 2.14):

Miranda Jones<br>
E-Mail: <a href="mailto:miranda@mirandas-world.com">
miranda@mirandas-world.com</a>
Click To expand
Figure 2.14: A link to the author's e-mail address can be added to the address block.
Tip 

Not every browser can use a mailto link. Some earlier versions of Internet Explorer, still used by some users, do not recognize mailto links. To make sure your e-mail address is available to everyone, when creating a mailto link, include your e-mail address both in the URL and as the link text.

The Problem with Mailto Links

If we lived in a perfect world, there would be no need for imperfect solutions. Many spammers use Web robots (or spambots) that roam the Web looking for and harvesting e-mail addresses. By including your e-mail address in Web pages you publish to the Web, you will be exposing yourself to spambots. There are a number of steps you can take to protect yourself from this:

  • Don't include your e-mail address in your address block. Instead, sign up for a free guestbook application and add it to your page in place of your e-mail address. Visitors to your page can then use your guestbook to give you feedback about your page. Other visitors can also read the feedback you receive (unless you choose to exclude that link). To find free guestbook applications you can add to your pages, just do a search on "free guestbooks" at Yahoo! (www.yahoo.com/).

  • FIND IT ONLINE
    Sign up for a free e-mail address from an online "Webmail" provider and include that e-mail address on your Web pages, while reserving your personal (or private) e-mail address for only friends and relatives. Include a notice that you change your public e-mail address periodically to fight spam and that visitors should check back at your page to find your current public e-mail address. To find free Webmail providers, just do a search on "free e-mail" at Yahoo!

  • Some Web authors use an HTML form that uses a script located on their server to process responses in order to solicit feedback and provide a way for visitors to contact them. The script then forwards the responses to the author's e-mail address. Because the script is run on the author's server, spambots can't get access to it to harvest the e-mail address. You learn how to create HTML forms in the Sunday Mid-Day session, "Working with Forms."

  • Alternatively, you can create a graphic that displays your e-mail address and insert it on your page. You wouldn't be able to set it up as a link, but anyone who is using a graphical browser and has display of images turned on can view your image to find out your e-mail address, without spambots being able to find out what it is. If you do this, you should combine it with one of the other alternative feedback methods (a guestbook or a form), so that legitimate visitors using nongraphical or text-only browsers, or who have turned off display of graphics in their browsers, will not be blocked from finding out your e-mail address and be left with no way of contacting you. You learn about inserting an inline image in a Web page in the Saturday Mid-Day session, "Creating a More Advanced Page."

  • FIND IT ONLINE
    Another option is to use a JavaScript script to hide your e-mail address in a mailto link. This will allow visitors to click on the mailto link to contact you, while hiding your e-mail address from spambots. The primary drawback to this is that a visitor has to have JavaScript turned on for it to work (if it is turned off, they won't be able to see your e-mail address at all). Spambots are also getting more sophisticated, so a simple JavaScript script can no longer guarantee protection. A more sophisticated approach is to also encrypt your e-mail address by replacing characters with their corresponding numerical entity codes. For an online utility that will do this for you, try the Enkoder Form at www.hiveware.com/enkoder_form.php. Just copy and paste the resulting code into your HTML document.


Team LiB
Previous Section Next Section


JavaScript EditorDebugger script     Dhtml css