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'>
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center


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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

790 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