Mick said:
<input type=text onchange="alert('text change');">
Mick
If you change the value programmatically, then you have to call the "onchange()" method
of the element you are changing programmatically as well:
<form name="myForm">
<input type="text"
name="myInput"
value="old text"
onchange="alert('text changed');">
<input type="button"
value="Change text"
onclick="changeInput('new text', this.form.elements['myInput']);">
</form>
<script type="text/javascript">
function changeInput(s, element) {
element.value = s;
// the next line fires the onchange event of the element
element.onchange();
}
</script>
--
| Grant Wagner <
[email protected]>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-developer/upgrade_2.html