<input name=txt onkeypress="setTimeout('ss=txt.value.replace(ss, \'\');alert(ss)');" onkeydown="ss=value">

解决方案 »

  1.   

    to hrong:
    厉害!为什么要这样做?
      

  2.   

    就象你所说, String.fromCharCode(event.keyCode) 要得到大小写等比较麻烦,所以我用了一个全局变量 ss 在 onkeydown 时得到一个老的字符 在 onkeypress 里用延时法得到新的字符串, 与老的字符串比较留下的就是你刚才输入的东西
      

  3.   

    就象你所说, String.fromCharCode(event.keyCode) 要得到大小写等比较麻烦,所以我用了一个全局变量 ss 在 onkeydown 时得到一个老的字符 在 onkeypress 里用延时法得到新的字符串, 与老的字符串比较留下的就是你刚才输入的东西
      

  4.   

    ms-help://MS.MSDNQTR.2003FEB.2052/dhtml/workshop/author/dhtml/reference/methods/settimeout.htm
    里面iMilliSeconds Required. Integer that specifies the number of milliseconds 
    这儿没写那是延时多长时间?