I think the return depends on the browser, for me, if onChange works the same way in all browsers, i wouln'd see any problem.
On Wed, May 27, 2009 at 2:29 PM, Quest <[email protected]> wrote: > > I have to improve some really old and historic grown scripts with new > functions. > Some of them require to read out, store and remove the hard-coded > attribute "onChange" of some input elements to be able to prevent the > execution in some cases. > > so far... > > Example: > There is an element like this: > <input type="text" value="blubb" name="myElement" id="myElement" > onChange="someThingsToDoOnChange()" /> > <script> > alert($('myElement').getProperty('onChange')); > </script> > > If I read the attribute onChange in FF it works like I expect. > But in IE7 the value of my attribute onChange is grabbed by a function > called anonymus: > function anonymus() > { > someThingsToDoOnChange() > } > > My workaround looks like this: > onchange = $('myElement').getProperty('onChange'); > if(Browser.Engine.trident){ > var stripfunction = /^function anonymous\(\)\n{\n(.*)\n}/m; > onchange = stripfunction.exec(onchange.toString())[1]; > } > > In IE8 this workaround throws an error: "'exec(...).1' is null or not > an object" > I can't verify this because on my PC is still IE7 installed. > > Do you have an idea how to fix this? > Is there a chance that a future release of MT could remove this > function anonymus by itself? > > Greetings from germany, Quest > -- fax : (+33) 08 26 51 94 51
