Onkeydown function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Onkeydown function

sry for Bad english ^^ i want to move a Box one px to the left, everytime when i click on spacebar (HTML,js)

22nd Dec 2016, 10:30 AM
Fakemaster
Fakemaster - avatar
1 Answer
+ 2
You need use events handling for listen at the keyboard on one hand, and on the other to stylish your box with the properties "position" set to "relative" and "left" dynamically set to "0" or "-1px" with javascript ( so you'll have to look at the functions for manipulating the DOM -- Document Object Model )...
22nd Dec 2016, 11:10 AM
visph
visph - avatar