0
Write a JavaScript code to change a background color using buttons.

Mumbai University > information technology > sem 4> Web Programming

Marks: 5M

Year : May16

0  upvotes
0

JavaScript code to change a background color using buttons Program:

<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script language="javascript">
function ChangeColor()
{
document.getElementById('btn1').style.backgroundColor='Red';
setTimeout("ChangeColor2()",2000);
}
  function ChangeColor2()
{
document.getElementById('btn1').style.backgroundColor='Pink';
setTimeout("ChangeColor3()",2000);
}
function ChangeColor3()
{
document.getElementById('btn1').style.backgroundColor='Green';
setTimeout("ChangeColor4()",2000);
}
function ChangeColor4()
{
document.getElementById('btn1').style.backgroundColor='Red';

}
  </script>
 </head>

 <body>
  <input type="button" onmouseover="ChangeColor()" value="Button" id="btn1" />
 </body>
</html>
0  upvotes
Please log in to add an answer.

Next up

Read More Questions

If you are looking for answer to specific questions, you can search them here. We'll find the best answer for you.

Search

Study Full Subject

If you are looking for good study material, you can checkout our subjects. Hundreds of important topics are covered in them.

Know More