回车按键自定义事件

ajax聊天界面中,由于是镶嵌在游戏界面中,有很多按钮,于是看了下如何让enter键直接指定在send按钮上

  方法是:在body tag那里加上keyCode是否13的判断。
   body onkeyup=”if(event.keyCode==13){sendMessage();}”
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s