问题1:
input文本框输入完成后回车,或者是失去光标时,触发事件。
实现方式
onchange="window.alert('触发事件,处理事情')" //失去光标时,触发事件并处理
onkeypress=" if(event.keyCode==13) { window.alert('触发事件,处理事情'); return false;}" //回车触发事件并处理
注: 在onkeypress事件中必须加入 return false;语句 主要避免input中的输入项丢失。
完整的例子:
<input type="text" id="inputGoodNo" style="197px;Height:31px;Font-Size:X-Large" onchange="... do some thing...." onkeypress=" if(event.keyCode==13) { ... do some thing....; return false;}"/>