View Full Version : How do write anchor tag script?
zapinfotech
09-28-2008, 04:52 PM
Hi,
I m very please for having membership of this forum.
I m looking for anchor tag script, like when someone click on any image or text, it goes to that particular paragraph in the same page.
How can I write this anchor tag script?
zapinfotech
TheJoshMan
09-28-2008, 04:54 PM
that's easy.
Let's say you have a paragraph in your page you would like to have the user be able to navigate to. You would need to add an "ID" to that paragraph like this...
<p id="name_me_something">
This is a bunch of meaningless text...
</p>
Then to make a link to that paragraph, simply use this..
<a href="#name_me_something">Click to go to paragraph</a>
TheJoshMan
09-28-2008, 04:59 PM
forgot to mention, you could also link to that specific paragraph from ANOTHER page...
Let's say you have a link on "Page 2" that you want to go to "Page 1 - Paragraph 2", you would first need to create the paragraph in page 1 and give it an ID "paragraph-2".
<p id="paragraph-2">
This is random text...
</p>
Then on page 2, you would make the link like this...
<a href="page1.html#paragraph-2">Click to go to page 1- paragraph-2</a>
zapinfotech
09-28-2008, 05:19 PM
thanks buddy
its working
zapinfotech
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.