<html xmlns="http://www.w3.org/1999/xhtml"><head>??? <title></title>??? <script type="text/javascript">??????? function add() {??????????? var inputs = document.getElementsByTagName("input");??????????? for (var i = 0; i < inputs.length; i++) {??????????????? var input = inputs[i];??????????????? input.onkeydown = function () {//??????????????????? alert(window.event.keyCode); //按回車顯示為13//??????????????????? alert(window.event.keyCode == 13);//顯示為true??????????????????? if (window.event.keyCode == 13) {??????????????????????? ??????????????????????? window.event.keyCode = 9;//??????????????????????? alert(window.event.keyCode);//顯示為9??????????????????? }??????????????? };??????????? }??????? }
??? </script></head><body? onload="add()">??? <input id="Text1" type="text" />??? <input id="Text2" type="text" />??? <input id="Text4" type="text" />??? <input id="Text3" type="text" />??? <input id="Text5" type="text" /></body></html>
在IE8上測試正常,在IE9上無反應,不知道如何解決
ie9RC版兼容性
慕碼人8056858
2018-12-07 07:05:51