Hallo Struppi.
und hier eine lange, lange Diskussion, wie man die zwei (bzw. drei) Methoden richtig einsetzen könnte http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
Ah, sehr gut. Kombiniert ergibt dies nun also Folgendes:
function addEvent(obj, type, fn) {
if (obj.addEventListener) {
obj.addEventListener(type, fn, false);
} else if (obj.attachEvent) {
var eProp = type + fn;
obj['e' + eProp] = fn;
obj[eProp] = function() {
obj['e' + eProp](window.event);
};
obj.attachEvent('on' + type, obj[eProp]);
} else {
var oLoad = obj['on' + type];
if (typeof(obj['on' + type]) != 'function') {
obj['on' + type] = fn;
} else {
obj['on' + type] = function() {
oLoad();
fn();
}
}
}
}
Dies funktioniert nun offenbar sogar im IE 5.0.
Einen schönen Sonntag noch.
Gruß, Ashura
--
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
„It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
[HTML Design Constraints: Logical Markup]
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
„It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
[HTML Design Constraints: Logical Markup]