把text的值用一个变量保存起来

解决方案 »

  1.   

    怎么保存啊?我在触发这个事件的时候text的值已经改变拉。如果getElementById的话得到的就是新的值了
      

  2.   

    Test every change bewteen before onkeyup and after onkeyup event fire?
    it does not sound it matter about that compare.
    try it as follows:<INPUT TYPE="text" NAME="txt" onkeyup="(this.value!=preval)?alert('Alter'):alert('Same')" onkeydown="preval=this.value">another method of compare:
    <INPUT TYPE="text" NAME="txt" onfocus="preval=this.value" onblur="(this.value!=preval)?alert('Alter'):alert('Same')">
      

  3.   

    onpropertychange 当在对象上发生对象上发生属性更改时触发。 
    这个事件是改变之前触发的