<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="js判断是否按回车键并兼容各种浏览器" id="card1">
<p> 游客</p><p>
标题:js判断是否按回车键并兼容各种浏览器<br/>
正文:<br/>
代码如下:<br/>&amp;lt;li class=&quot;item pin&quot;&amp;gt; <br/>&amp;lt;span class=&quot;overlabel&quot; style=&quot;display: block;&quot;&amp;gt;请输入验证码&amp;lt;/span&amp;gt; <br/>&amp;lt;input type=&quot;text&quot; class=&quot;txt&quot; id=&quot;checkNum&quot; name=&quot;checkNum&quot; maxlength=&quot;4&quot; onkeydown=&quot;keyboardEvent(event);&quot; /&amp;gt; <br/>&amp;lt;img src=&quot;${basePath}/randomImageCodeStyle&quot; width=&quot;60&quot; height=&quot;28&quot; id=&quot;chkNum&quot; title=&quot;单击重新加载验证码&quot; style=&quot;cursor: hand&quot; /&amp;gt; <br/>&amp;lt;/li&amp;gt; <br/><br/>代码如下:<br/>//监听Enter键自动提交事件 <br/>function keyboardEvent(event){ <br/>var keyCode=event.keyCode ? event.keyCode:event.which?event.which:event.charCode;//解决浏览器之间的差异问题 <br/>if(keyCode==13){ <br/>submitForm(); <br/>} <br/>} <br/><br/>jQuery丢弃了标准的 button 属性采用 which，这有点让人费解。 <br/><br/>which 是Firefox引入的，IE不支持。which的本意是获取键盘的键值(keyCode)。 <br/>jQuery中的which即可以是键盘的键值，也可以是鼠标的键值。<br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1087&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1087&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1087&amp;Page=1">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=1087">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=1087">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>