change button color in javascript
In the program we will show you How do change button color using javascript .In javascript we are using onmouseover it is used to record mouse move.Source code
<html> <head> <script type="text/javascript"> function changeColor(color) { document.getElementById('MyButton').style.background=color; } </script> </head> <body> <p>Move mouse over the color string</p> <table width="60%"> <tr> <td bgcolor='red' onmouseover="changeColor('red')">RED</td> <td bgcolor='yellow' onmouseover="changeColor('yellow')">YELLOW</td> <td bgcolor='aqua' onmouseover="changeColor('aqua')">AQUA</td> </tr> </table> <form> <input id="MyButton" type="button" value='changing color of buttons'> </form> </body> </html> |