> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 28, 2007 9:17 AM
> To: CF-Talk
> Subject: Add a javascript handler to the window.onload event
> 
> What is a good way to added a javascript event handler to the
> windows.onload event that already has one or more handlers associated
> with it, without impacting them?

I think that my PanelManager can help:

http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_P
anelManager/Index.cfm

I made a small modification that will let you create a panel out of the
window object.  You can then manage events (in IE, Opera and FireFox) the
same way using the event management methods.  Any existing handler will be
maintained.

I've appended an example which creates three separate handlers for the load
event.

Hope this helps.

Jim Davis


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">

<html>
<head>
   <title>DP_PanelManager Example: Window Event Example</title>
   <script type="text/javascript" src="DP_PanelManager.js"></script>
</head>
<body style="padding: 0px; margin: 0px;">

<h3>Window Event Management</h3>

<p>This is an example of using the DP_PanelManager to manage window
events.</p>
<p>The code adds the window object as a new panel and then adds three events
(functions which contain alerts) to the "load" event.</p>

<script type="text/javascript">

        PanelManager = new DP_PanelManager();
                // Create Panel out of the Window Element
        myWindow = PanelManager.addPanel(window);

        myWindow.addEvent("load", alert1);
        myWindow.addEvent("load", alert2);
        myWindow.addEvent("load", alert3);
        function alert1(Event) {
                alert("Alert One");
        };
        function alert2(Event) {
                alert("Alert Two");
        };
        function alert3(Event) {
                alert("Alert Three");
        };

</script>


</body>
</html>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289790
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to