Friday, April 8, 2011

how bookmark the paragraph inside html document

HTML Links

« Previous Next Chapter »

Links are found in nearly all Web pages. Links allow users to click their way from page to page.


Examples

Try it Yourself - Examples

HTML links
How to create links in an HTML document.

(You can find more examples at the bottom of this page)


HTML Hyperlinks (Links)

A hyperlink (or link) is a word, group of words, or image that you can click on to jump to a new document or a new section within the current document.

When you move the cursor over a link in a Web page, the arrow will turn into a little hand.

Links are specified in HTML using the tag.

The tag can be used in two ways:

  1. To create a link to another document, by using the href attribute
  2. To create a bookmark inside a document, by using the name attribute

HTML Link Syntax

The HTML code for a link is simple. It looks like this:

Link text

The href attribute specifies the destination of a link.

Example

Visit W3Schools

which will display like this: Visit W3Schools

Clicking on this hyperlink will send the user to W3Schools' homepage.

Tip: The "Link text" doesn't have to be text. You can link from an image or any other HTML element.


HTML Links - The target Attribute

The target attribute specifies where to open the linked document.

The example below will open the linked document in a new browser window or a new tab:

Example

Visit W3Schools!

Try it yourself »


HTML Links - The name Attribute

The name attribute specifies the name of an anchor.

The name attribute is used to create a bookmark inside an HTML document.

Note:
The upcoming HTML5 standard suggest using the id attribute instead of the name attribute for specifying the name of an anchor.
Using the id attribute actually works also for HTML4 in all modern browsers.

Bookmarks are not displayed in any special way. They are invisible to the reader.

Example

A named anchor inside an HTML document:

Useful Tips Section

Create a link to the "Useful Tips Section" inside the same document:

Visit the Useful Tips Section

Or, create a link to the "Useful Tips Section" from another page:


Visit the Useful Tips Section

Bind Some Event to Element and trigger that function when click the element

Scenario: Suppose if we used same click event function in various web pages. if you want do some logic some page button for that need to re...