⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyevent.htm

📁 这是一些关于JavaScript的学习资料 希望对大家有用
💻 HTM
字号:
<html>
<head>
<title>Listing 9.7. Getting Specific Key Values - 品络科技 pinluo.com</TITLE>
</head>

<body>

<form>
<b>Click inside this text box and press a key.<br>
The key pressed appears in the status bar.</b>
<br>
<input 
    type="text" 
    onKeyPress="return keypress_handler(event)">
</form>

<script language="JavaScript" type="text/javascript">
<!--

function keypress_handler(key_event) {
    
    if (document.all) {
        //Probably Internet Explorer 4 and later
        status = String.fromCharCode(event.keyCode)
        return true
    }
    else if (document.getElementById) { 
        // Probably Netscape 6 and later
        status = String.fromCharCode(key_event.which)
        return true
    }
    else if (document.layers) {
        // Probably Netscape 4
        status = String.fromCharCode(key_event.which)
        return true
    }
}

//-->
</script>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -