Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I add "controls" or commands to a webpage using HTML?

When writing code for a webpage using HTML, I know how to display text, images etc

However, how will I make the user interact with the page?

I would like to create a situation where, for example, the user enters the "R" key and an image changes to another image, or "W" and an image appears. These are just examples, to give you an idea of what I mean by controls.

2 Answers

Relevance
  • Anonymous
    5 years ago

    HTML is a markup language to display a document with text and images in a browser. It has no programmability. For that you will need to add some Javascript (or similar) that will allow the user to interact with the web page but you are then entering the realms of a web app rather than a web page.

    http://www.w3schools.com/js/tryit.asp?filename=try...

  • Chris
    Lv 7
    5 years ago

    To react to keypresses, you need to add an event handler to the window using JavaScript.

    Example: https://jsfiddle.net/xtmcugzr/

Still have questions? Get your answers by asking now.