tlavelle Posted August 30, 2007 Share Posted August 30, 2007 is there a way to link to a location on a page like in the example below but instead of the link existing on the same page as the target location, the link exist on one page and points to a bookmark on another page? So for example, I want index.html to have a link that takes the user to chapter 4 of content.html (which is half way down the page) <p> <a href="#C4">See also Chapter 4.</a> </p> <h2>Chapter 1</h2> <p>This chapter explains ba bla bla</p> <h2>Chapter 2</h2> <p>This chapter explains ba bla bla</p> <h2>Chapter 3</h2> <p>This chapter explains ba bla bla</p> <h2><a name="C4">Chapter 4</a></h2> <p>This chapter explains ba bla bla</p> Quote Link to comment https://forums.phpfreaks.com/topic/67364-solved-link-to-a-specific-location-on-another-page/ Share on other sites More sharing options...
php_tom Posted August 30, 2007 Share Posted August 30, 2007 Ya it's easy. in tmp1.html: <html> <body> <a href='tmp2.html#C4'>Go to chapter 4 in tmp2.html</a> </body> </html> then in tmp2.html: <html> <body> <p> <a href="#C4">See also Chapter 4.</a> </p> <h2>Chapter 1</h2> <p>This chapter explains ba bla bla</p> <h2>Chapter 2</h2> <p>This chapter explains ba bla bla</p> <h2>Chapter 3</h2> <p>This chapter explains ba bla bla</p> <h2><a name="C4">Chapter 4</a></h2> <p>This chapter explains ba bla bla</p> </body> </html> Hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/67364-solved-link-to-a-specific-location-on-another-page/#findComment-338002 Share on other sites More sharing options...
soycharliente Posted August 30, 2007 Share Posted August 30, 2007 Also, if you use the id attribute on any of your tags, you can reference that with the #idname system. Example: <html> <body> <div id="bar"> Hello world! </div> <!-- Imagine a ton of other data here so that the page would have to scroll. --> <div id="foo"> 1 2 3 4 5 6 7 8 9 0 </div> </body> </html> If you go to index.html#foo or index.html#bar, it will jump to those div locations. Quote Link to comment https://forums.phpfreaks.com/topic/67364-solved-link-to-a-specific-location-on-another-page/#findComment-338051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.