Link to home
Start Free TrialLog in
Avatar of DColin
DColinFlag for Thailand

asked on

Link to half way down a web page.

Hi Experts,

I have a web page called mypage.aspx that will contain links to itself in the form:

<a href="mypage.aspx?country=England>Link</a>
<a href="mypage.aspx?country=Scotland>Link</a>
<a href="mypage.aspx?country=Wales>Link</a>

These links will be at different places on the web page.

What I want is that when a link is clicked the page loads from the position of the link that was clicked. So the user does not have to scroll down to find the link they just clicked.
Avatar of Jack Leach
Jack Leach

Put a link with an octothorpe and the div id.

<a href="#thisplace">jump here</a>
...
...
<element id="thisplace" />

Open in new window


Hth
Avatar of DColin

ASKER

Where would my "mypage.aspx?country=England" link go.
The ?key=value indicates a query string, which is generally interpreted by your script to take particular action (for example, loading "England" type data from a database).

What you need is something different, and it's pure HTML.

Instead of:

<a href="mypage.aspx?country=England>Link

Open in new window


use this:

<a href="mypage.aspx#England">Link

Open in new window


Then, as long as you have some HTML element with an ID of "England", the page will jump/autoscroll so that element is at the top.
Avatar of DColin

ASKER

The '?country=England' part of the link is an argument that is required by the page asp code. This can not be altered. I need some way of jumping to the point in the page from where the link was clicked.
Is the ASP code processing that URL/querystring and outputting HTML from it?  If so, you'll need to modify the HTML output to include your internal links and anchors accordingly.

If you need this functionality to be available from an external link, you will have to write the ASP logic to interpret the querystring passed to it and adapt your outputted HTML accordingly.

Again, this anchor jumping is pure HTML, not part of any scripting language, so whatever HTML output you're getting from the request, include the #anchorname links in that.

It's hard to say more without seeing more detail on what's going on.

Hope that helps...
-jack
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah, sorry, I didn't realize you could slap an anchor to the end of a query string, hadn't done it before.