Solved

Link to half way down a web page.

Posted on 2014-01-29
7
520 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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 43

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

730 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