Tryit Editor v1.4

<html> <head> <script type="text/javascript"> function changeColor(color) { document.getElementById('x').style.background=color; } </script> </head> <body> <p>This example demonstrates how to change the background color of a button.</p> <p>Mouse over the three colored table cells, and the background color will change:</p> <table width="100%"><tr> <td bgcolor="red" onmouseover="changeColor('red')"> </td> <td bgcolor="blue" onmouseover="changeColor('blue')"> </td> <td bgcolor="green" onmouseover="changeColor('green')"> </td> </tr></table> <form> <input id="x" type="button" value="Mouse over the colors"> </form> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself