onchange event

Garrett Smith dhtmlkitchen at gmail.com
Sun Mar 8 18:51:03 PDT 2009

On Sun, Mar 8, 2009 at 12:44 PM, Erik Arvidsson
<erik.arvidsson at gmail.com> 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?)


> On Sun, Mar 8, 2009 at 05:39, memolus at googlemail.com
> <memolus at googlemail.com> 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; }

More information about the Es-discuss mailing list