Jump to content

Two-column table with links to location on same page


Styler001

Recommended Posts

Using this as an example from w3schools website:

 

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

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

 

I would like to do something similar to the following....

 

I would like to create a 2-column table.  The first column would contain about 12 links like the "#C4" above.  When you click on one of them, you would be taken to the appropriate part of the page in the second column that that link points to.

 

I have it working like I would like (sort of), but the one issue I have is that the number of clickable links in the first column is wayyyyyyyyyyy shorter than the total number of lines in the second column.  So, my list of links is situated down at the middle of the page, rather than at the very top of it.  I understand why it's doing what it's doing, but is there a way to force the links to be at the very top of the column?

Link to comment
Share on other sites

Thanks.  That worked.  I was trying <td align="top"> (not valign) before, thinking that would do it.

 

One more question...

 

Is there an anchor or something that I can include that, when clicked on, will return the user to the top of the page?  All I could seem to find on w3schools was some javascript example that didn't seem to be appropriate for what I want.

 

Actually, one other question as well...

 

I see that you can put a frame to the right of the columns, which in my case would put one to the right of column one AND one to the right of column two.  Is it possible to just put one frame BETWEEN the two columns only?

 

Thanks again.

Link to comment
Share on other sites

Just put <a name="blah"> at the top of your page. (More generally, anywhere you like.) And then, anywhere else on your page, clicking this:

 

<a href="#blah"> Click here </a>

 

will take you there. As for frames, I'd make three columns in the table, and simply put the frame in the middle one.

Link to comment
Share on other sites

I don't why I didn't think of that for the "top" option.  Guess I was just looking for a command HTML might have.

 

As for the right-side frame, I don't see how I could do that with three columns.  From what I can tell (which isn't much at this point), it seems that frames would apply to all three columns, so I'd have frames showing up on the right side of all three columns.  I thought the "frame" code would be placed within the "table" tag, affecting the whole table.

Link to comment
Share on other sites

Hmmm....Couldn't find the edit button to edit my last post.  Sorry.

 

Rather than just moving back to the top of the table, I wanted to go all the way to the very top of the page.  I've actually got some graphics and text above the table, so I wanted the "top" to go all the way up there.  Here's how I solved that:

 

<script type=\"text/javascript\">
function scrollWindow()
{
window.scrollTo(0,0);
}
</script>

 

and used this at different points within the table:

 

<form>
<input type=\"button\" onclick=\"scrollWindow()\" value=\"Top of  Page\">
</form>

Link to comment
Share on other sites

Rather than just moving back to the top of the table, I wanted to go all the way to the very top of the page.  I've actually got some graphics and text above the table, so I wanted the "top" to go all the way up there.

 

You can actually put <a name="blah"> at the very top of the page, above the graphics and text. But if the javascript works for you, go for it. A third option is simply to link to the page itself, so the whole page just reloads all over again. -but not if your page takes a long time to load.

 

As for the right-side frame, I don't see how I could do that with three columns.  From what I can tell (which isn't much at this point), it seems that frames would apply to all three columns, so I'd have frames showing up on the right side of all three columns.  I thought the "frame" code would be placed within the "table" tag, affecting the whole table.

 

Okay, I can't help with this then. I was thinking of an inline frame, which you can certainly lodge within a pair of <td> ... </td> tags, but you may have something else in mind.

Link to comment
Share on other sites

You can actually put <a name="blah"> at the very top of the page, above the graphics and text. But if the javascript works for you, go for it. A third option is simply to link to the page itself, so the whole page just reloads all over again. -but not if your page takes a long time to load.

 

I had thought of just reloading the page, but it has a visitor counter on it that I don't want to have artificially inflated because of a reload.  And I think I'd have to go into another PHP file to put the "blah" at the very top of the page.  I had someone else program my site for me, and the easiest thing for me was to put that javascript in the HTML file I've been working with.

 

As for the right-side frame, I don't see how I could do that with three columns.  From what I can tell (which isn't much at this point), it seems that frames would apply to all three columns, so I'd have frames showing up on the right side of all three columns.  I thought the "frame" code would be placed within the "table" tag, affecting the whole table.

 

Okay, I can't help with this then. I was thinking of an inline frame, which you can certainly lodge within a pair of <td> ... </td> tags, but you may have something else in mind.

I'm not opposed to the inline frame if you think that would work.  I'm just such a noob at any of this that I have to ask for help and examples.

Link to comment
Share on other sites

An inline frame is just a window (somewhere within your page) onto some other page. Try this out and you will see what I mean:

 

<table style="width:100%">
<tr>
<td style="width:33%">column one</td>
<td style="width:33%"><iframe src="http://www.google.com" style="width:100%"></iframe></td>
<td style="width:33%">column three</td>
</tr>
</table>

 

The inline frame lies in the middle column, and is a window onto google's homepage. But of course you can just change the src value to any other page you like, e.g., one of your other pages. If you can work with this, it is easy to grasp, but I don't know what your aim is. I don't normally work with frames, I must confess, so I may be the wrong person to guide you here.

Link to comment
Share on other sites

Hmmm...I don't think that's quite what I was looking for.  I played around with that using different %'s and other options, but it just doesn't seem to be what I need.

 

I appreciate your suggestions, though.  Thanks.  :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.