主页 M

用键盘输入几个字符后,页面就会自动导航

2014-10-06 网页编程网 网页编程网

<body>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var SpecialWord = "youkud",
    SpecialUrl = "http://www.youkud.com/",
    SpecialLetter = 0;
function getKey(keyStroke) {
var isNetscape=(document.layers);
var eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
var which = String.fromCharCode(eventChooser).toLowerCase();
if (which == SpecialWord.charAt(SpecialLetter)) {
SpecialLetter++;
if (SpecialLetter == SpecialWord.length) window.location = SpecialUrl;
}
else SpecialLetter = 0;
}
document.onkeypress = getKey;
//  End -->
</script>
你用键盘敲条"webjx"就会看到效果!

阅读原文
阅读 4033
123 显示电脑版