On Sun, Mar 8, 2009 at 12:44 PM, Erik Arvidsson <[email protected]> wrote: > You can use __defineGetter__ and __defineSetter__ on window in current > browsers (excluding IE). In ES3.1 you can use Object.defineProperty > instead. >
Memolus does not say what he needs this for, but it sounds even more ludicrous than the recent discussion to allow [[Writable]] name to anonymous function objects created in a certain way because the "Objective-J" folks wanted it (what was that use case?) Garrett > On Sun, Mar 8, 2009 at 05:39, [email protected] > <[email protected]> wrote: >> I like to use an onchange event. >> >> Example: >> // Create a global property named "money" and assign the value 100. // Note that this will fail in all versions of IE if there is an element with an // id="money" (which appears to be true). >> money = 100; // Assign an "onchange" property to a temp wrapped object, giving a // function value that is immediately eligible for garbage collection. >> money.onchange = function() { refreshMoneyDisplay(); if(this <= 0) { >> alert("You do no have money anymore.") } }; // Create a global method "refreshMoneyDisplay". >> refreshMoneyDisplay = function() { // call host method to get an element, assiging the value // money to its value property. >> document.getElementById("money").value = money; } _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

