<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body {
font-family: "Microsoft YaHei", serif;
}
body, dl, dd, p, h1, h2, h3, h4, h5, h6 {
margin: 0;
}
ol, ul, li {
margin: 0;
padding: 0;
list-style: none;
}
img {
border: none
}
</style>
</head>
<body>
<a href="">111</a>
<input type="text">
<input type="password">
<input type="radio">
<input type="checkbox">
<script>
// onkeydown
// 都能触发
// onkeypress
// 能键入内容的事件才触发
// onkeyup
// 哪些元素能够添加键盘事件(能用tab键选中的元素,就可以添加键盘事件)
// 表单元素
// a
// document/window
// 可编辑的div
// ...
// keyCode可以看到按键编号
// which不仅可以看到键盘 还可以看到鼠标
// 组合按键在ev中查看 组合按键会有true
// 阻止F5的默认事件
document.onkeydown = function (ev) {
console.log(ev.keyCode);
console.log(ev);
if (ev.keyCode===116){
ev.preventDefault();
}
}
</script>
</body>
</html>
Python3Turtle