Saturday 25 January 2014

javascript prog for demonstrating dynamic styles

<!--html prog for demonstrating dynamic styles
http://improvejavascript.blogspot.in/-->
<html>
 <head>
  <script type="text/javascript">
  function display(color_name)
  {
    document.body.style.backgroundColor=color_name;
  }
 </script>
 </head>
 <body>
 <form name="form1">
 <b> enter some color name here:</b> <br>
 <input type="text" name="text1"> <br><br><br>
 <input type="button" name="button1" value="click to change background color" onclick="display(form1.text1.value)">
</body>
</html>

enter any color in tha text field. Ex: red
click on button

No comments:

Post a Comment