Friday 13 February 2015

HTML page for Color Button to using JavaScript

<html>
<head>
       <script type="text/javascript">
     function changeBorderColor(color)
   {
         document.getElementById("ddy").style.backgroundColor=color;
     }

      </script>
</head>
      <body>
       <div id="ddy" style="height:100px; width:600px; border:solid 4px black;" >
               Change Border Color:
             <input type ="button" value="Red" onclick="changeBorderColor('Red');"/>
             <input type ="button" value="Green" onclick="changeBorderColor('Green');"/>
            <input type ="button" value="Blue" onclick="changeBorderColor('Blue');"/>
             <input type ="button" value="Yellow" onclick="changeBorderColor('Yellow');"/>
            <input type ="button" value="Pink" onclick="changeBorderColor('Pink');"/>
            <input type ="button" value="White" onclick="changeBorderColor('White');"/>
                    <input type ="button" value="Orange" onclick="changeBorderColor('Orange');"/>
                   <input type ="button" value="" onclick="changeBorderColor('Red');"/>
    </div>
      </body>
</html>

No comments:

Post a Comment