Set - 3

Question 6 :

How do I link to a location in the middle of an HTML document? 

Answer :

First, label the destination of the link. The old way to label the destination of the link was with an anchor using the NAME attribute. For example:

<h2><a name="section2">Section 2: Beyond Introductions</a></h2>

The modern way to label the destination of the link is with an ID attribute. For example:

<h2 id="section2">Section 2: Beyond Introductions</h2>

Second, link to the labeled destination. The URL is the URL of the document, with "#" and the value of the NAME or ID attribute appended. Continuing the above examples, elsewhere in the same document you could use:

<a href="#section2">go to Section 2</a>

Similarly, in another document you could use:

<a href="thesis.html#section2">go to Section 2 of my thesis</a>


Question 7 :

How do I create a link?

Answer :

Use an anchor element. The HREF attribute specifies the URL of the document that you want to link to. The following example links the text "Web Authoring FAQ" to

<A HREF="">Web Authoring FAQ</A>


Question 8 :

How do I create a link that opens a new window? 

Answer :

<p><a target="_blank" href=...></p> opens a new, unnamed window.
<p><a target="example" href=...></p> opens a new window named "example", provided that a window or frame by that name does not already exist.
Note that the TARGET attribute is not part of HTML 4 Strict. In HTML 4 Strict, new windows can be created only with JavaScript. links that open new windows can be annoying to your readers if there is not a good reason for them.

Question 9 :

How do I let people download a file from my page? 

Answer :

Once the file is uploaded to the server, you need only use an anchor reference tag to link to it. An example would be:
<p><a href="../files/">Download Foo Now! (100kb ZIP)</a></p>

Question 10 :

How do I create a button which acts like a link? 

Answer :

This is best done with a small form:

<INPUT TYPE=submit VALUE="Text on button">

If you want to line up buttons next to each other, you will have to put them in a one-row table, with each button in a separate cell. 
Note that search engines might not find the target document unless there is a normal link somewhere else on the page. 
A go-to-other-page button can also be coded in JavaScript, but the above is standard HTML and works for more readers.