cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Joseph <pjos...@gmail.com>
Subject Re: bug with double-listbox?
Date Fri, 07 Nov 2008 16:52:23 GMT
This works nicely thanks!

One thing though...the line in the else statement:

element.attachEvent( 'on' + type, handler );

is giving me a runtime type mismatch error in IE7.

What does it do really.  When I comment it out, things seem to continue 
to work ;-)

rgds
Paul


Jason Johnston wrote:
> On 11/06/2008 06:05 PM, Paul Joseph wrote:
>> But if I have a JavaScript function say:
>>
>> function myFunction() {
>> alert ("loaded");
>> }
>>
>> and if I call this function on page load either by using
>> window.onload=myFunction;
>>
>> OR by
>> <body onLoad="javascript:scrollToPosition();">
>>
>> then the double-list box stops working.
>
>
> This is most likely because CForms adds its own initialization 
> function using the same onload property, so adding yours overwrites it.
>
> Nowadays it's best practice to avoid using on[event] properties, and 
> use instead the DOM2 event methods (forking for IE's nonstandard event 
> model.)  Any of the common javascript libraries will handle this for 
> you behind the scenes, or you can write a simple abstraction function:
>
> function addEvent( element, type, handler ) {
>     if( element.addEventListener ) {
>         element.addEventListener( type, handler, false );
>     } else {
>         element.attachEvent( 'on' + type, handler );
>     }
> }
>
> addEvent( window, 'load', myFunction );
> addEvent( window, 'load', myOtherFunction );
> //etc...
>
> This allows you to add as many listeners as you want rather than being 
> limited to one.
>
> --Jason
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message