HTML Link
HTML links are easy to write and use.
<a href=http://google.com target=_blank>This is a link to Google</a>
-To link to another web page, we use the HTML anchor tag <a>
-We use the
href attribute to specify a web address. In this case, Google.
-We use the target attribute to say we want the link to load in a new window (
_blank)
Options for the
target attribute are:
_blank - Loads in a new window, as mentioned above.
_top - Loads in the current window. Busts out of a frameset.
_parent - Loads in the Parent Frame.
_self - Loads in the current frame.
The name of any frame you would like the link to load in.
To link to something on the very page you are on:
<a href=#dude>This link takes you there.</a>
<a name=dude>This is where you end up.</a>
-First we create our link. A pound symbol # is placed in from of the
anchor name.
-We create the anchor and name it
dude because we like the name.
NOTES: If this anchor isn't somewhere on the page away from our link, the link won't appear to do anything. The link will move the browser window to the anchor only if necessary. Test it out.
You'll also notice the #dude is tacked onto the URL in your address bar. Just a little tidbit for no reason.
You can also use HTML links to open a piece of email for the user.
<a href="mailto:chris@ilovethecode.com?subject=Have Fun, Dog!">Send me Email!</a>
-We put
mailto: in the href attribute.
-We put the email address we wanted the mail to go to.
-We put a question mark after the email address.
-We put the subject attribute after the question mark.
-We put our glorious title for the email.
NOTES: Don't forget to wrap the value of the href attribute in quotation marks, or your email subject will get cut off if you have spaces.
You can also put Javascript in HTML links.
onClick
onMouseover
onMouseout
<a href=http://google.com onClick="alert('Have fun at Google!')">This is a link to a better world.</a>
Resources:
HTML Tutorials
Frames in HTML
Title Tag in HTML
The Classic BareBones Guide to HTML
W3C's Official HTML 4.01 documentation
Tags in HTML
Color Chart in HTML
HTML Codes