cómo usar el evento keydown si cambio getElementById a getElementByTagName
código de recorte de w3school
<script> function keydownFunction() { document.getElementById("demo").style.backgroundColor = "red"; } function keyupFunction() { document.getElementById("demo").style.backgroundColor = "green"; } </script>cambié a
<p> <input type="text" id="demo" onkeydown="keydownFunction()" onkeyup="keyupFunction()"> </p> <script> function keydownFunction() { document.getElementsByTagName("p").style.backgroundColor = "red"; } function keyupFunction() { document.getElementsByTagName("p").style.backgroundColor = "green"; } </script>y no funciona