Hi there,
I want to write a JavaScript event handler that handles the 'onchange' event of a drop-down list (<select>). This even handler should take different actions based on the old value and the new value of the select. Is that possible What I'm looking for is something like this:
<select onchange="eventhandler" />
funciton eventhandler(e) {
if (e.oldValue = 1 && e.newValue = 2) { ... }
if (e.oldValue = 3 && e.newValue = 2) { ... }
}
Thanks in advance,
Eli

[Q:] Event handler for onchange event (old and new value) - how to?
Ofir Epstein
If it's only possible for IE, why would you want to do it Unlike Sidebar gadgets, Web gadgets really should target multiple browsers. The current minimum set is IE6, IE7, and Firefox, but if you have the time you should make your gadgets work on Opera 9 as well. Single-browser tricks for core functionality is a Bad Idea (tm), though you could use some of the built-in browser detection to compensate for browser deficiencies (for example, I have a gadget in the works right now that uses an alpha-blended PNG to add a little visual flair. Since IE6 doesn't play nicely with PNGs, even when using the AlphaImageLoader hack, I've added a small conditional to only render the PNG on non-IE6 browsers. Looks great in Firefox, Opera, and IE7, and boring-but-functional in IE6).
Hf Kok
Hooper