1.11M Members

Jump to another part of a document (on the same page)

 
0
 

Have you ever wanted a link to go to the bottom of the same page? Well in this snippet you see how..

1) On the top where is says

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

is a link going to Chatpter 4 at the bottom of the page if you look at Chapter 4 in the Snippet

<a name="C4"><h2>Chapter 4</h2></a>
<p>This chapter explains ba bla bla</p>

There is <a name="C4"> which was is the same as up on top where the link is to chapter 4.
2) That is IT!

<html>
<body>

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

<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>

<a name="C4"><h2>Chapter 4</h2></a>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 5</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 6</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 7</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 8</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 9</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 10</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 11</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 12</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 13</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 14</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 15</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 16</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 17</h2>
<p>This chapter explains ba bla bla</p>

</body>
</html>
 
0
 

Thanks, just was wondering how to do that. (I dont work with html often)

 
0
 

I've always wanted to know how those things were done, too lazy too Google it :) Good work!

 
0
 

How can I jump to another link?

 
0
 

useful. anyways how about if you want to click a link and it will be shown on the same page and in on a specific table? is tha possible?

 
0
 

anyways how about if you want to click a link and it will be shown on the same page and in on a specific table?

If it was in the same page to begin with, yes. If you have a table with content inside down at the bottom of the page and you want to go down there with a single click, this code will do just that. You just need to put an <a> tag on something inside the table with a name, then on the link you have the href property set to the anchor (#) and then the name. Just like in the OP's code.

If you mean loading content from another page, into the page you're currently on, you need to use jQuery or AJAX.

 
0
 

yeap. im actually thinking of If you mean loading content from another page, into the page you're currently on. thanks

 
0
 

Given <a name='linkname'></a> is the target
on the same page <a href='#linkname'>goto linkname</a> on another local page <a href='../relativefolder/page#linkname'>goto linkname</a> cross site page <a href='http://www.thatsite.com/page#linkname'>goto linkname</a> the target does not have to be an <a>anchor, any named element can be the target, the actual target is the name not the element itself

 
0
 

useful. anyways how about if you want to click a link and it will be shown on the same page and in on a specific table? is tha possible?

something like using the onclick event to change the innerhtml of the table cell
may work, but I dont use tables for layout so am out of touch

 
0
 

Thanks.
Very easy made.

Have you ever wanted a link to go to the bottom of the same page? Well in this snippet you see how..

1) On the top where is says is a link going to Chatpter 4 at the bottom of the page if you look at Chapter 4 in the Snippet

There is <a name="C4"> which was is the same as up on top where the link is to chapter 4.
2) That is IT!

 
0
 

Nice !!! Never thought it would have been this easy!! =D

You
Post:
Start New Discussion
Tags Related to this Article