11
Tutorial 2 Links

Tutorial 2

Embed Size (px)

DESCRIPTION

Tutorial 2. Links. Hypertext links are used to…. Point to a different section on the same page Point to a different web page Point to a variety of different web objects. Links within the same page. First we need to mark the destination text with an anchor - PowerPoint PPT Presentation

Citation preview

Page 1: Tutorial 2

Tutorial 2

Links

Page 2: Tutorial 2

Hypertext links are used to….

• Point to a different section on the same page

• Point to a different web page

• Point to a variety of different web objects

Page 3: Tutorial 2

Links within the same page

• First we need to mark the destination text with an anchor

• This is done by putting <a href=“#name”> before the destination text, and </a> after

• In this example name is the name of the anchor

Page 4: Tutorial 2

• Then we need to create a link, identifying the anchor that goes with this link

• < a href=“#name”>Classes</a>

• Now when a user clicks on this link he will be directed to the anchor and the destination text

• Note that the # is NOT optional

Page 5: Tutorial 2

Different Web Page Structures

• Make sure you read through the different structures on pages 2.12-2.14

Page 6: Tutorial 2

Linking to Another Web Page

<a href= “contact.htm”>Contact me </a>

produces the text “Contact me” identified as a link

Clicking on this link will send the user to the page contact.htm

In this example contact.htm MUST be in the same folder as the original web page

Page 7: Tutorial 2

Suppose the link is on your page which is located in the folder C:\Homework, but the page you want to link to is located in C:\labwork\junk

You must now create the link by writing

<a href= “C:\labwork\junk\contact.htm”> Contact me </a>

Page 8: Tutorial 2

Link to other documents on the internet

<a href = http://www.sxu.edu> sxu’s website</a>

If you want it to open in a different window:

<a href=“url” target = window>hypertext</a>

Window is the name of the window – it can be anything. If the windows are the same name, the pages will all open in the same window – so you get different windows by using different names

Page 9: Tutorial 2

<a href = “http://www.sxu.edu/cs.html#majors”> computer science majors</a>

links to an anchor called majors on the webpage called cs.html which is on sxu’s website, www.sxu.edu

See page 2.29 for instructions how to create a link to an email address.

Page 10: Tutorial 2

Labwork: When complete, upload all to your private directory on csmaster and email me the links. (one link per case)

Complete the tutorial page 2.03- 2.22.Case 1. Case 2

Homework: Due Sat 11th Sept at midnightCase 3

Page 11: Tutorial 2