Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <script> function color(color) { document.forms[0].myInput.style.background = color; } </script> </head> <body> <h1>JavaScript HTML Events</h1> <h2>The onkeydown and onkeyup Attributes</h2> <form> Write a message:<br> <input type="text" onkeydown="color('yellow')" onkeyup="color('white')" name="myInput"> </form> </body> </html>