Changing Attribute Value Daynamically



Write a javascript code to demonstrate getElementById() and method.

<html>
  <head>
    <title>dynamically Changing Element attribute</title>
      <script>

        function change(Element)
        {
            Element.style.color='blue'
            Element.style.backgroundColor ='silver'
        }

      </script>
    </head>
  <body>

<form name="entry" action="" method="">

      Country :<input type="text" value="Australia" name="Cname" onchange="change(this)"/>
      <br><br>

      State :<input type="text" value="Queensland" name="Sname" onchange="change(this)"/>
      <br><br>

      <input type="button" name="b2" value="Send">
       
    </form>        
  </body>
</html>

Output: