Set page to focus some certain location after post back

H

Hardy Wang

Hi,
I have a web form, after post back to itself, I need to make web page
scroll to some certian location instead of top. We only care IE.
Anybody has some idea how to do it?
 
A

aa7im

You will probably need to do this by using Javascript and using anchor
tags.

Place name anchors throughout the page like:

<a name="top">Top</a>
<a name="middle">Middle</a>
<a name="bottom">Bottom</a>

Then you could push Javascript out from the code-behind something like:

<script>
window.navigate('#bottom');
</script>

The page would then scroll to the bottom. Just make sure your
javascript appears last in the page after all the sections of the page
have been named...
 
W

William F. Robertson, Jr.

If you know the postition you want.

//client side script
function __dascwebLoadScrollPosition( top, left )
{
window.document.body.scrollLeft = top;
window.document.body.scrollTop = left;
}

You can set the scrollLeft and scrollTop of the body. If you don't know the
position, you can do aa7im suggested with anchor tags.

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top