Choosing where to start displaying a page

Posted on 2003-10-27
Last Modified: 2010-04-09
I want to put a mark in my html to tell the browser to set focus on that mark or to start displaying from that mark.

Here is the task:
Two pages,
Page one:a long list, spanning many windows down.
Page two:an edit page, letting the user edit One entity from the list, using the post-method.

Each link takes you to a diffrent screen/page that lets you edist the entity that link symbolises using method=post and asp and db. Now, when you have entered the new information in the edit-window I want to go back to the list. Since its so long and the users will want to go through the list, editing one entity at a time, I want to start displaying the list from where they pressed the link. I have the information needed for this, ie the name/number of the entity. When im building the html i could just write the right tag if I knew what it was.

But internal linking on pages requires the querystring method rather than post, right? And I need to use the post method, submitting with a button. And the moment that button is pressed on the edit-page, the list doesent exist yet(its re-rendered each time the user submits since some other user might have changed the list and to give feedback to the user-editing) Isnt there just some tag which tells the browser to start displaying the html from where the tag is placed? Or mebbe i should use javascript to auto-link somehow?

Question by:erikjonsater
  • 3
  • 3
  • 2
LVL 15

Accepted Solution

VincentPuglia earned 100 total points
ID: 9627159
I'm not exactly certain what the problem is, but you can  return to a specific link on the list page by using anchors like the following:

<a name='link1'>&nbsp;</a>
<a href="#link1" onclick='somefunc(this, 1)'>the link</a>

<a name='link2'>&nbsp;</a>
<a href="#link2" onclick='somefunc(this, 2)'>the link</a>

<a name='link3'>&nbsp;</a>
<a href="#link3" onclick='somefunc(this, 3)'>the link</a>

then when you return to the list, you address it as follows:




Expert Comment

ID: 9630989
I think you're looking for something like this?:


span  {

<span id='s1'>Section 1<p>Blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah </span><p>
<span id='s2'>Section 2<p>Bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh </span><p>
<span id='s3'>Section 3<p>Bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh </span>

<script type='text/javascript'>
args =
if(args.length>-1)   {
  args = args.substr(args.indexOf('?') + 1).split('=')[1]
  document.getElementById(args).style.display = "block"


<form action='edit.html' method='post'>
<input type='checkbox' name='ch1' value='s1'><span id='s1'>Section 1<p>Blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah <br>blah blah blah </span><p>
<input type='checkbox' name='ch2' value='s2'><span id='s2'>Section 2<p>Bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh <br>bleh bleh bleh </span><p>
<input type='checkbox' name='ch3' value='s3'><span id='s3'>Section 3<p>Bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh <br>bluh bluh bluh </span><p>
<input type='submit' value='View checked entry">


Expert Comment

ID: 9631006
few corrections:  you probably want to make those radios with the same name so only one can be selected, and make the last input on the long page:
<input type='submit' value='View selected entry'>
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!


Author Comment

ID: 9641939
Many thanx for the advise so far.
Seems Im a very poor comunicator. And im not that good at html either. Ill try these soloutions out tonight, i dont quite understand them yet. Until then, here is a more detailed description if you care to read it(I dont know if the advise you have already given me is anough yet)

The longlist is written in a form, formLonglist.
The link on each row in the longlist calls a javascript function, sending that rows id as parameter.
The javascript function submits the formLonglist, sneaking in the value of the id of the link/entity/row into a hiddenfield in the formlonglist. The javascript function then submits formlonglist. Formlonglist will typically consist of the following form-elements:
id = an int
headercodes = int,int,int ...
rooms=int, int,int ...
state=int  //is analysed at the top of file to determine what im doing next
headercodes are sent along in the formfields. They are originally userinput and controls the number of columns in longlist.
rooms are sent along in the formfields. They are originally userinput and controls the number of rows in the longlist.
id is the id for one row in the longlist.

the editview then lets users edit the database - (edit the subset of headers that the user picked sometime earlier, for the room choosen in longlist)
Once the user presses a button, 'save', in the editview basically the same stuff is submitted in the form 'oneroomForm'. Alot of other stuff is also sent in that form, basically the values to the headercodes:
id=an int, headercodes=1,3,5..
1=value //here the name of the form-element is an int, corresponding to one of the headercodes.
Now, this stuff is anuff to update the database and to re-render the list from the database. Then i want to somehow tell the browser to start showing the new longlist from the row containing the id that was sent from the edit-view(before that selected by the user from the longlist). Obviously, ill have to do this when im creating the list from db-values. I can find the place since i have the 'id'. But i dont know what to write once i find it because im nogood at html. Maybe i can just concatenate the id onto the action="filename.asp" form in the edit-view, formOneRoom.

Author Comment

ID: 9642506
vinny's soloution looks promising.(is tonight here now)
LVL 15

Expert Comment

ID: 9642621
Hi erik,

 thank you.  if you need help modifying it, post some example code of the list and state the problem you are having.



Author Comment

ID: 9643640
Thanx Vinny
Well, your soloution works like a charm. Many thanx. By the way, is there any way i can link to the href-tag/anchor? Cause due to legacy this listview is kinda slow(db design is lunatic) as it is and i want to print as little as possible, the extra name-tag/anchour would be nice to do without.
LVL 15

Expert Comment

ID: 9643742
not really,

perhaps the code that produces the list itself can be pared.


Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

809 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