JS enter代替tab,只有部分键可以代替
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<script>
onload = function () {
var txts = document.getElementsByTagName('input');
for (var i = 0; i < txts.length; i++) {
if (txts[i].type == 'text') {
txts[i].onkeydown = function () {
//alert(window.event.keyCode);
if (window.event.keyCode==13) {//enter
window.event.keyCode = 9; //tab IE可以用
}
}
}
}
}
</script>
</head>
<body>
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<script>
onload = function () {
var txts = document.getElementsByTagName('input');
for (var i = 0; i < txts.length; i++) {
if (txts[i].type == 'text') {
txts[i].onkeydown = function () {
//alert(window.event.keyCode);
if (window.event.keyCode==13) {//enter
window.event.keyCode = 9; //tab IE可以用
}
}
}
}
}
</script>
</head>
<body>
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
</body>
</html>