我已经设置了一键跳过/更改页面功能。但是当用户想在输入文本或文本区域输入“0”时,一键功能也会生效并切换到另一页。
当用户使用文本输入或文本区域时,如何忽略此 java 脚本?
document.onkeydown=nextpage;
function nextpage(){
var event=document.all?window.event:arguments[0];
if (event.keyCode==13) location="#skipcontent";
if (event.keyCode==48) location="contact-us.php";
}
Run Code Online (Sandbox Code Playgroud) javascript ×1