Solved

Link to half way down a web page.

Posted on 2014-01-29
7
485 Views
Last Modified: 2014-01-29
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.
0
Comment
Question by:DColin
  • 4
  • 2
7 Comments
 
LVL 4

Expert Comment

by:Jack Leach
ID: 39819463
Put a link with an octothorpe and the div id.

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

Open in new window


Hth
0
 

Author Comment

by:DColin
ID: 39819477
Where would my "mypage.aspx?country=England" link go.
0
 
LVL 4

Expert Comment

by:Jack Leach
ID: 39819483
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.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:DColin
ID: 39819493
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.
0
 
LVL 4

Expert Comment

by:Jack Leach
ID: 39819503
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
0
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39819510
You just need to add the named anchor at the end of your link:

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

<div id="England">.
0
 
LVL 4

Expert Comment

by:Jack Leach
ID: 39819514
Ah, sorry, I didn't realize you could slap an anchor to the end of a query string, hadn't done it before.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This video teaches users how to migrate an existing Wordpress website to a new domain.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now