Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 15th, 2004, 03:25 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Scrolling modal dialog to top

I have an ASP.NET application that displays a modal dialog with a scrollbar (using window.open).

The form is larger than the size of the window I am opening. The idea is that the dialog opens in the middle of the screen and the user is then able to use the vertical scroll bar to scroll to the required section of the form.

The problem is: when the form appears the window is automatically scrolled to the bottom of the form. Using window.scrollTo(0,0) to move to the top of the form has no affect.

What am I doing wrong?

Cheers,
Gary

 
Old September 15th, 2004, 05:24 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Try using
Code:
document.body.doScroll("pageUp");
. May need to call it more than once.

--
Joe
 
Old September 15th, 2004, 05:33 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Joe,

Unfortunately on a modal dialog, that gives the following error
"document.body is null or is not an object"

Cheers,
Gary

 
Old September 15th, 2004, 07:04 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well you must be calling the code before the dialog has finished loading. Call it from the onload handler.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying modal dialog from server code gp_mk HTML Code Clinic 16 July 1st, 2007 07:55 AM
how to return value from modal dialog ajaypsingh Javascript 2 May 16th, 2006 05:14 AM
Modal Dialog window Problem anandham Javascript 7 February 16th, 2005 06:08 PM
Modal dialog window eldanh ASP.NET 1.0 and 1.1 Basics 0 August 10th, 2004 02:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.