Setting background of input box to red - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Setting background of input box to red

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w w w .ja  v a  2 s  .  c o m*/
document.getElementsByName('Q_101')[0].style.backgroundColor='red';

    }

      </script> 
   </head> 
   <body> 
      <input type="text" name="Q_101" size="4" value="1" class="form_input_general">  
   </body>
</html>

Related Tutorials