<script type="text/javascript">
function send(event){
//如果按了回车键也发送信息
if(event.keyCode==13) {//键盘按下Enter键
sendMessage();
}
}
function sendMessage(){
...
}
</script>
...
<p>
<input type="text" id="text" onkeypress="send(event)"/>
<input type="button" value="发送" >
</p>
...
本文链接http://www.cxybl.com/html/wyzz/JavaScript_Ajax/20130122/36420.html
时间: 2024-12-31 01:16:46