how can I make my page move down

Last post 11-10-2009 9:33 PM by joejr. 5 replies.

Sort Posts:

  • how can I make my page move down

    11-07-2009, 9:42 AM
    • Member
      13 point Member
    • joejr
    • Member since 09-20-2008, 10:04 AM
    • Posts 56

    I have a form with 3 divs the second two of which are hidden. At the end of the first div is a button with the text "Save and Continue". When the user clicks this button the second div becomes visible. The first div takes up most of the sreen so it's hard to notice the second div becomming visible. What I'd like to do either on the client or server end is have the screen automatically scroll down x number of lines when the second div becomes visible so that most of the second div appears on the screen. Thanks for any suggestions. 

  • Re: how can I make my page move down

    11-07-2009, 11:59 AM
    • All-Star
      98,232 point All-Star
    • mbanavige
    • Member since 11-06-2003, 1:29 PM
    • New England, USA
    • Posts 10,355
    • Moderator
      TrustedFriends-MVPs
    Mike Banavige
    ~~~~~~~~~~~~
    Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/
  • Re: how can I make my page move down

    11-07-2009, 12:04 PM
    • Participant
      1,641 point Participant
    • vishwaraj1
    • Member since 11-07-2008, 7:44 PM
    • India
    • Posts 424

    use panel instead of div.. it will not take space when its visible  is false.

    Regards:

    Vishwaraj Malik

    VB to C# Converter


    Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
  • Re: how can I make my page move down

    11-08-2009, 8:22 PM
    • Member
      13 point Member
    • joejr
    • Member since 09-20-2008, 10:04 AM
    • Posts 56

    Thank you for your responses. In this case I don't think it matters whether I'm using panel or div. The javascript function which assigns focus to a field farther down on my form was very helpful. The problem with this method though is that if I assign focus (which I can just as easily so through the code behind) to the first field in the next section, the screen doesn't really move down far enough or at least as far as I'd like. If I assign focus to a field farther down, it moves the screen perfectly but then the focus isn't on the right field. So what I'd really like is a routine I can call which will scroll the screen down the number of lines I define.  

  • Re: how can I make my page move down

    11-08-2009, 8:54 PM
    • All-Star
      98,232 point All-Star
    • mbanavige
    • Member since 11-06-2003, 1:29 PM
    • New England, USA
    • Posts 10,355
    • Moderator
      TrustedFriends-MVPs

    The javascript sample i linked to isnt for setting the focus.  Its just for scrolling and it could be used to scroll to an element that is further down your form than the one you are going to give the focus to.  Just give it the ID of an element that is further down the page.

    Mike Banavige
    ~~~~~~~~~~~~
    Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/
  • Re: how can I make my page move down

    11-10-2009, 9:33 PM
    • Member
      13 point Member
    • joejr
    • Member since 09-20-2008, 10:04 AM
    • Posts 56

    ok, I've tried the javascript sample in my code as follows. After my first section I have an asp:button control on which I add OnClientClick="movecursor();".

    My movecursor function and the function it calls are as follows: (note that "divMortPct" is the id of the div where I want the screen to scroll down to)

    function movecursor()
                {
                    alert("in movecursor");
                    //Get object
                    var SupportDiv = document.getElementById('divMortPct');
     
                    //Scroll to location of SupportDiv on load
                    window.scroll(0,findPos(SupportDiv));
                }
                //Finds y value of given object
                function findPos(obj) {
                 var curtop = 0;
                 if (obj.offsetParent) {
                  do {
                   curtop += obj.offsetTop;
                  } while (obj = obj.offsetParent);
                 return [curtop];
                 }
                }

    When I click the button, movecursor starts to execute but in the 3ird line of function findPos (underlined) I get an "object required" error.

    I'm hoping someone can advise me on what I'm doing wrong. Thanks.

Page 1 of 1 (6 items)