L Layer object (Object/Navigator) Event handling support (My web site)

L Layer object (Object/Navigator) Event handling support via properties containing function objects was added to Layer objects at version 1.1 of JavaScript. The example demonstrates how to control a scrolling panel and do it in a way that is cross browser compliant for MSIE and Netscape version 4. There are a lot of issues to deal with, not least the fact that Netscape supports layers but MSIE does not. It is necessary to use layers for scrolling in Netscape because you can only scroll windows or frames in Netscape if they have visible and active scrollbars. Also, the two browsers scroll vertically in opposing directions. If you are careful about the sizing of your objects, and relate the size of the window/frame the layer is drawn in, you can accomplish a continuous scrolling effect by duplicating items from the top of the list to the bottom. Then at an appropriate point, you can jump scroll back to the top of the list. If you do this right, it will appear as if the list is endless and scrolling gently in a continuous loop. This technique is a much simplified example taken from the Video On Demand console at http://www.bbc.co.uk/news where there is a panel showing a listing of live TV programs in a scrolling pane. Warnings: . If you are using layers to position items temporarily on the screen, then you should be careful when using absolute positioning. This can cause the layer to be absolutely positioned relative to the current mouse position and not the window border. The effect is that an item in the positioned layer will appear to follow the mouse as it is clicked. You may need to work out the mouse position and then calculate an offset to relocate the layer where you want it. You may be able to detect the mouse by removing focus from the layer that has the problem, or it may be necessary to create an empty layer which can be safely attached to the mouse. All of these issues are Netscape 4 specific. . Layers are no longer supported in Netscape 6.0. Example code: