Jörn Zaefferer schrieb:
> So show would have either a Number value (delay) or a String like "onclick" 
> or "click". "click" would be intersting, then I could implement that like 
> this:
> 
> [...]
> if(typeof settings.show == "String")
>   this[settings.show](show);
> [...]

Interesting how ideas evolve at the same time... I recently had to do this:

var handler = $.browser.msie ? 'keydown' : 'focus';

$(document)[handler](function(e) {
     // handle event
});

That was much shorter than duplicating the code and having a branch like 
that:

if () {
     $(document).keydown( ... );
} else {
     $(document).focus( ... )
}


Yeah, JavaScript rocks! Still learning...


-- Klaus




_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to