js同时按下两个方向键
作者:mdxy-dxy 时间:2024-05-02 17:21:45
具体代码如下所示:
<SCRIPT LANGUAGE="JavaScript">
<!--
var dn=0; //1 up, 2 left, 3 both
document.onkeyup = function()
{
if(event.keyCode== 37)
{
if(dn==2)
{
dn=0
}
else if(dn==3){dn=1}
}
if(event.keyCode== 38)
{
if(dn==1){dn=0}
else if(dn==3){dn=2}
}
}
document.onkeydown = function()
{
if(event.keyCode== 37)
{
ren.innerText="aa"//向左
if(dn==0){dn=2}
else if(dn==1){dn=3}
}
else if(event.keyCode==38)
{
ren.innerText="bb"//向上
if(dn==0){dn=1}
else if(dn==2){dn=3}
}
if(dn==3)
{
dn=0
alert("cc")
}
}
//-->
</SCRIPT>
<div id=ren></div>
总结
以上所述是小编给大家介绍的js同时按下两个方向键网站的支持!
标签:js,方向键
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
浅谈LogMiner的使用方法
2009-02-28 11:12:00
SQL对冗余数据的删除重复记录只保留单条的说明
2024-01-17 07:24:11
Centos7.4环境安装lamp-php7.0教程
2023-11-16 03:07:24
![](https://img.aspxhome.com/file/2023/5/103415_0s.png)
Matplotlib实现subplot和subplots简单对比
2022-07-29 05:49:10
![](https://img.aspxhome.com/file/2023/8/95538_0s.png)
SQL Server Parameter Sniffing及其改进方法
2024-01-28 02:56:30
![](https://img.aspxhome.com/file/2023/6/98046_0s.png)
python树的同构学习笔记
2022-10-23 02:06:29
![](https://img.aspxhome.com/file/2023/5/103145_0s.jpg)
windows下Python实现将pdf文件转化为png格式图片的方法
2022-03-22 08:55:51
基于python 微信小程序之获取已存在模板消息列表
2022-02-25 16:51:25
Server.HTMLEncode让代码在页面里显示为源代码
2023-11-24 13:40:28
Python装饰器的应用场景及实例用法
2022-06-24 16:09:03
Python基础之模块详解
2023-02-24 23:23:52
![](https://img.aspxhome.com/file/2023/2/68432_0s.png)
python神经网络MobileNet模型的复现详解
2022-09-24 19:54:14
![](https://img.aspxhome.com/file/2023/0/120570_0s.png)
python脚本实现验证码识别
2022-02-03 09:41:30
![](https://img.aspxhome.com/file/2023/4/79664_0s.jpg)
Python运算符优先级详细整理
2021-12-17 06:38:14
![](https://img.aspxhome.com/file/2023/5/135305_0s.png)
MYSQL本地安装以及出现的问题解决
2024-01-25 00:00:36
![](https://img.aspxhome.com/file/2023/1/71721_0s.jpg)
Oracle Instr函数实例讲解
2024-01-14 18:05:32
python语言是免费还是收费的?
2021-12-30 10:04:48
SQL 新增/修改 表字段列的类型等
2024-01-20 01:20:59
python用opencv批量截取图像指定区域的方法
2021-10-14 09:07:33
laravel中短信发送验证码的实现方法
2023-11-15 08:05:16
![](https://img.aspxhome.com/file/2023/0/91210_0s.jpg)