Asit wrote:
In JavaScripts checks for an onChange event against the value of the
textbox at the time of the last onChange event. Since an onChange
Event never fired after you changed the text first time , suppose we
put the same value in the text box then no event is fired.
If we put some other value then it became fired...
It wouldn't fire if we put the same value...
I don't want to use onBlur etc... Isthere any solution with onChange
Event...?
Asit
Asit,
Can I ask why you don't want to use onblur? It sound right for what
you're describing.
http://tech.irt.org/articles/js058/
# onChange - select, text, or textarea field loses focus and its value
has been modified.
# onBlur - form element loses focus or when a window or frame loses focus.
--------
For IE ONLY (NOT Netscape/Firefox...) you might try 'onpropertychange',
it will catch text entry identical to the original text value, or
pasting the original text value.
If you use it - you probably should include 'onchnage' for non-IE
browsers, but I think 'onblur' would be more appropriate. So unless you
are using 100% IE, I would recommend onblur.
<script type="text/javascript">
function doit() { alert('onchange fired'); }
function doit2() { alert('onpropertychange fired'); }
function doit3() { alert('onblur fired'); }
</script>
<table>
<tr>
<td>onchange</td>
<td><input type="text" value="onchange" onchange="doit()" size="28"></td>
</tr>
<tr>
<td>onpropertychange</td>
<td><input type="text" value="onchange, onpropertychange"
onpropertychange="doit2()" onchange="doit()" size="28"></td>
</tr>
<tr>
<td>onchange</td>
<td><input type="text" value="onblur" onblur="doit3()" size="28"></td>
</tr>
</table>
Good Luck,
Mike