查看: 1328|回复: 3
|
js onkeypress 菜鸟问题 !求救~
[复制链接]
|
|
这一段在 firefox 没效果(IE , Google都行 ) !最怕兼容问题了 !求救啊~~
<script type="text/javascript">
window.document.onkeypress = function() {
if(event.keyCode == 13 &&
event.srcElement.tagName.toUpperCase() == "INPUT" &&
event.srcElement.type == "text") {
alert(event.cacelBubble);
event.cancelBubble = true;
event.returnValue = false;
}
}
|
|
|
|
|
|
|
|
发表于 5-3-2013 11:24 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 7-3-2013 03:53 AM
|
显示全部楼层
GoodMorning 发表于 5-3-2013 11:24 PM 
用jquery ,
可以免了以上問題..
你指的是 event.preventDefault(); 吗?
|
|
|
|
|
|
|
|
发表于 16-3-2013 05:16 PM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|