...

View Full Version : Need to move back to top of window



Tulsa
03-15-2005, 07:10 PM
I have a very simple javascript:

<script language="javascript">
function moveroom(num)

{
document.checkin.room_number.value=num;

}
</script>

Basically the user scrolls through a long list and selects the value which is then put into the textbox. After this is done, I would like the window to focus back to the very top of the page. I have tried top.window.focus() to no avail. I have also tried setting the focus in the textbox, but this does not get all the way back to the top. Any ideas, I'm sure there is a command I just don't know about. Thank you for help.

codegoboom
03-15-2005, 08:22 PM
There's the "scrollTop" property...

Tulsa
03-15-2005, 09:43 PM
Thanks for the reply

As far as I know the scrolltop property just gives the value of the how far down the page has scrolled relative to the top of the page. I need something that resets the scrollbar to the top. I can reset the value to zero, but that does not move the bar. Thanks for any help

Tulsa
03-15-2005, 09:49 PM
Codegoboom, I wonder if maybe you meant the "scrollto" property? It worked great.

<script language="javascript">
function moveroom(num)

{
document.checkin.room_number.value=num;
scrollTo(0,0);
}
</script>

codegoboom
03-16-2005, 05:56 AM
Actually, I meant scrollTop--which is read/write, you know... ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum