[latex]Mae govannen![/latex]
ich hab schon in vielen JavaScripten so eine Notation gesehen,
weis aber weder wie sie heißt , noch was genau sie macht.
Z.B. ein Stück aus Prototype
Browser: {
IE: !!(window.attachEvent && !window.opera),
Opera: !!window.opera,
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
}
Das ist die Objekt-Literal-Schreibweise.
Anders könnte man das so schreiben:
Browser = {}; // entspricht in Etwa Browser = new Object()
Browser.IE = !!(window.attachEvent && !window.opera);
Browser.Opera: !!window.opera;
usw.
Cü,
Kai
--
„It's 106 miles to Chicago, we got a full tank of gas, half a pack of cigarettes, it's dark, and we're wearing sunglasses“.
„Hit it!“
Selfzeugs
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?
„It's 106 miles to Chicago, we got a full tank of gas, half a pack of cigarettes, it's dark, and we're wearing sunglasses“.
„Hit it!“
Selfzeugs
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?