Write a program to change the HTML element using events? - DOM

Write a program to change the HTML element using events?



- Events are used to get generated when an action on a particular object takes place, this way some values gets changed or manipulated within a region.

- Event handlers are used to handle the events and execute the code using which the event is occurring.

- Events are usually being generated by the browser, when an event on some object takes place like user clicks an element.

- The example is shown below that is used to change the HTML element values:

<html>
<body>
<input type="button" onclick="document.body.bgColor='green';"
value="Change background color" />
</body>
</html>
Post your comment