Programs in JavaScript
11. onChange Event example.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function fun1() { txt = document.getElementById("name") txt.value = txt.value.toUpperCase() txt.style.color = "green" } </script> </head> <body> Name : <input type="text" id="name" onchange="fun1()"/><input type="button" value="Hello" /> </body> </html>Output :