Results 1 to 5 of 5

Thread: Floating Button

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    ottawa canada
    Posts
    41

    Floating Button

    Hi,
    I am working with ASP.NET in VB.NET and I wanted, in my webpage, a button, that always stays at the bottom of the page. If the user scrolls down, the button should move down to the bottom.
    Is there anyway I can do that?

    Thanks

  2. #2
    Member
    Join Date
    Aug 2001
    Location
    Ottawa
    Posts
    38

    Re: Floating Button

    Below is the code I use to have a floating table stay in the visible window as the users scroll.

    Will cause the control specified to always stay at the top of a window when the user scroll down the page
    In the HEAD section of the page add:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    window.onscroll = floatButton;

    function floatButton () {
    document.all.tblLegend.style.pixelTop = document.body.scrollTop;
    }

    function initLegend () {
    document.all.tblLegend.style.pixelLeft = 500;
    document.all.tblLegend.style.visibility = 'visible';
    }
    // End -->
    </SCRIPT>
    Add onLoad="initLegend()" to the BODY line of the page
    (<body MS_POSITIONING="GridLayout" onLoad="initLegend()">)

    Add the TABLE to the page
    <TABLE ID="tblLegend" STYLE="Z-INDEX: 101; VISIBILITY: hidden; POSITION: absolute; TOP: 0px">
    <tr>
    <td bgcolor="#006699"><font color="white" ><b>Field Legends</b></font>
    </td>
    </tr>
    </TABLE>

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    ottawa canada
    Posts
    41

    Re: Floating Button

    hey cfisher,

    thanks so much for the code!


  4. #4
    Member
    Join Date
    Aug 2001
    Location
    Ottawa
    Posts
    38

    Smile Re: Floating Button

    Your welcome. I found the basis for the code somewhere within this forum (I forget where so I can't give proper credit) and adjusted it to be easily transferrable between my different applications.

    Chris

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    ottawa canada
    Posts
    41

    Re: Floating Button

    yea instead of using a table, i just used a button, and it works perfectly fine. I adjusted the left positioning:

    document.all.tblLegend.style.pixelLeft = document.body.scrollLeft;

    So that it's always on the corner of the page no matter where you scroll.
    everything seems to work well
    thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width