...

View Full Version : Onclick



arun.mpk
07-18-2008, 04:00 PM
Hello all

I have a small issue...i have lots of text(different sections) on the same page...if the user clicks on the menu whcih is on the left hand side, it should point(take) to the appropriate section text...i wondering how to do that

Any help???

BoldUlysses
07-18-2008, 04:09 PM
Sounds like you're interested in an anchor. You use the <a> tags, but point the link inside the page rather than to an external file:

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_link_bookmark

In the example,


<a href="#C4">See also Chapter 4</a>

points to this:


<a name="C4">Chapter 4</a>

within the page.

jcdevelopment
07-18-2008, 04:11 PM
its call an "anchor" tag

this would be the link

<a href="#tips">Jump to the Useful Tips Section</a>

this is where it would jump to

<a name="tips">Useful Tips Section</a>

abduraooft
07-18-2008, 04:12 PM
Set a named anchor like

<a href="#section1">section 1</a>
<a href="#section2">section 2</a>
<a href="#section3">section 3</a> for each of your sections like


<div id="section1">section 1 content</div>
<div id="section2">section 2 content</div>
....

You can set such anchors to any element, having some id

Late .. though latest :) see http://www.w3.org/TR/xhtml1/#h-4.10

arun.mpk
07-18-2008, 04:26 PM
Thanks guys....its solved...much appreciated :)

VIPStephan
07-18-2008, 04:32 PM
Yes, to emphasize: Don’t use the name attribute! Except on form elements this attribute is deprecated and should not be used anymore. ID has the same effect along with many more possibilities.

jerry62704
07-18-2008, 07:28 PM
While "name" works (per the link provided in the thread), I understand that "id" is a better linking object.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum