View Full Version : Floating Submit button

11-07-2007, 12:54 PM
I have table that displays data pulled from a database for updating/changing and it can be quite long.
The submit button is at the bottom of the page but I was wondering if I could get the button to 'float' alongside the table as the user scrolls down/up the page.

That way they don't have to scroll all the way down if only entering data at the top.


11-07-2007, 01:15 PM
Something like:
<button style="position:fixed;right:2px;top:2px;_position:absolute;_top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop+screen.height*0.002 : document.body.scrollTop+screen.height*0.002)">bla</button>

The underscore values are only read by IE, and simulate the fixed position that IE<7 doesn't have. If you don't like hacking, you can use conditional statements.

Arie Molendijk.

11-07-2007, 04:26 PM
Works nicely thanks.
I put it into a table cell so that it is positioned correctly across the page if the table width changes. Also took out the right:200px as it made the button stretch across the whole page.

Many thanks.