View Full Version : Onclick
07-18-2008, 04:00 PM
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
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:
In the example,
<a href="#C4">See also Chapter 4</a>
points to this:
<a name="C4">Chapter 4</a>
within the page.
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>
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
07-18-2008, 04:26 PM
Thanks guys....its solved...much appreciated :)
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.
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.