gpt4 book ai didi

Javascript on Press Keydown "Q"按键 "1"和 "2"

转载 作者:行者123 更新时间:2023-11-29 23:17:15 25 4
gpt4 key购买 nike

<分区>

我已经尝试了很多东西,但仍然无法弄清楚如何按下 Q Keydown 事件?我的代码是这样的

JavaScript

document.addEventListener('keydown', function(e) {
if (e.key === 'q')
e.keypress = '1';
})
<div id="weapon_ui_container" style="display: block;">
<div class="weapon_button round_border hovered" id="weapon_ui_button_1" onclick="UI.weaponsUIController.onUIWeaponClick(0)">
<img src="/assets/sprites/entities/weapons_ui/hands_ui.png" class="weapon_button_image" id="weapon_button_image_1"> 1 </div>
<div class="weapon_button round_border" id="weapon_ui_button_2" onclick="UI.weaponsUIController.onUIWeaponClick(1)">
<img src="/assets/sprites/entities/weapons/hands.png" class="weapon_button_image" id="weapon_button_image_2"> 2 </div>

我需要一些帮助,我是 js 的新手。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com