Solved

Link to half way down a web page.

Posted on 2014-01-29
7
524 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

690 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