js在文本框回车触发事件的方法

来源:互联网 发布:网络老虎机揭秘 编辑:程序博客网 时间:2024/05/01 10:57

    

js在文本框回车触发事件的方法

       
先写一个js方法

function getKey()  

{  

 if(event.keyCode==13){    

alert('click enter');  

  }     

}  

在输入框加上onkeypress"getKey()"


<input type="text" id="urlstr"  style="width:1000px;" onkeypress="getKey();"/>  

0 0