<html>
<head>
<title>asd</title>
<script language="javascript">
function aa()
{
if (event.keyCode == 13)
{
if (event.srcElement.type != 'button')
{
event.keyCode = 9;
}
else
{
alert('button');
}
}
}
document.onkeydown = aa;
</script>
</head>
<body>
<form>
<input id='a' type="text" value='a'/>
<input id='b' type="text" />
<input id='c' type="button" />
<input id='d' type="text" />
<input id='e' type="button" />
</form>
</body>
</html>
按回车,光标到下一个控件,遇到按钮打住
最新推荐文章于 2024-05-11 16:34:19 发布
该博客展示了一段HTML和JavaScript代码。通过JavaScript定义函数,处理页面按键事件。当按下回车键时,若触发元素不是按钮,将按键码改为9;若是按钮,则弹出提示框。页面包含多个输入框和按钮。
1853

被折叠的 条评论
为什么被折叠?



