W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2007

Re: event for attribute change of a <select> (DOMAttrModified?)

From: Joćo Eiras <joao.eiras@gmail.com>
Date: Tue, 09 Jan 2007 03:09:18 -0000
To: Fulvio <www-dom@svsoliton.net>
Cc: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.tlu9pscqjz3wb9@dragast>


Opera works just fine with that testcase.
Mozilla, for me, on the other hand didn't get anything right.


Fulvio <www-dom@svsoliton.net> escreveu:

> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html><head><title>dynamic filters</title>
> <script type="text/javascript">
> function selectchange(select) {
>   var child = document.getElementById(dynfilterhierarchy[1]);
>   var foo = child.getAttribute("disabled");
>   if (foo) { child.removeAttribute("disabled", 0); }
>   else { child.setAttribute("disabled", "true", 0); }
> }
> function selectpropertychange(e) {
> //  console.log("event: %o, target: %s, name: %s, oldvalue: %s,
> newvalue: %s, change: %s, relatednode: %o", e, e.target.id, e.attrName,
> e.prevValue, e.newValue, e.attrChange, e.relatedNode);
>   alert("hello, world!");
> }
> </script>
> </head>
> <body>
> <fieldset>
> <legend>one</legend>
> <select id="dynfilter0" onchange="selectchange(this);">
> <option> </option>
> <option>Books</option>
> <option>Music</option>
> </select>
> <select id="dynfilter1" onpropertychange="selectpropertychange();">
> </select>
> <select disabled="disabled" id="dynfilter2">
> </select>
> </fieldset>
> <script type="text/javascript">
>   var dynfilterhierarchy = new Array("dynfilter0", "dynfilter1",
> "dynfilter2");
>   console.log(dynfilterhierarchy[1]);
>   var node = document.getElementById(dynfilterhierarchy[1]);
>   console.log(node);
>   node.addEventListener('DOMAttrModified', selectpropertychange, false);
> </script>
> </body></html>
Received on Tuesday, 9 January 2007 03:09:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT