当一个HTML元素的属性改变的时候,都能通过onpropertychange来捕获。例如一个<input />对象的value属性被页面的脚本修改的时候,onchange无法捕获到,而onpropertychange却能够捕获。 具体理解为:onpropertychange能及时捕获属性值的变化,而onchange在属性值改变时只有通过鼠标执行某些操作才能激活该事件! 上传图片立刻显示时经常用到,脚本改变<input />对象的value值时,可用onpropertychange事件。 <table width="200" border="1"> <form action="savetry.asp" method="post"> <tr> <td><input type="text" /></td> </tr> <tr> <td><input type="text" /></td> </tr> <tr> <td> <img src='../upimg/1.jpg' border="0" /> <input type='file' onpropertychange="document.getElementById('TestImg').src=this.value;" /> <input readonly="" type="text" class="wenbenkuang" size="28" onpropertychange="document.getElementById('TestImg').src='../'+this.value;"> <a href=# ../upfilepic_get.asp?formname=guanggao&editname=guang_1&uppath=upimg&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">上传图片</a> </td> </tr> <tr> <td><input type="submit" /></td> </tr> </form> </table>