Many web pages don't fit on most users' screens. The visitors have to scroll to read the page contents.
Such scrolling however hides the navigation menus usually located at the top of the page.

Newer browsers (such as Firefox or Internet Explorer 7) support position:fixed
CSS option to pin something to particular window place. However page layout will
be ruined if it is not supported by the browser. The javascript sample here will try
to use position:fixed if available, falling back to moving
DIV with position:absolute if fixed positioning isn't available.
Most notable browser not to support position:fixed is Internet
Explorer 6, which is still widely used when this article was written.

Create a DIV
element with id of 'floatdiv' which contains the menu markup. Please note that
it should have osition:absolute (which will be changes on the fly
to position:fixed by through javascript if it is supported
by the browser). Initial position should be specified via
left, right, top, bottom
CSS properties.
For example:

*: Ok means the browser supports position:fixed and the best
visual effect is achieved.
**: Jumpy means the browser doesn't support position:fixed
and a DIV with position:absolute is repositioned
when the page is scrolled.
***: Graceful degradation means the box is shown in its
initial place with position:absolute and
is not moved.