0% found this document useful (0 votes)
40 views1 page

Program No.1.html

This HTML document contains a simple web page with a form that includes two buttons: one to change the background color automatically every five seconds and another to display a status message. The background color cycles through an array of colors (red, yellow, cyan, orange, indigo). The JavaScript functions handle the color change and alert the user with a message about the automatic color change.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views1 page

Program No.1.html

This HTML document contains a simple web page with a form that includes two buttons: one to change the background color automatically every five seconds and another to display a status message. The background color cycles through an array of colors (red, yellow, cyan, orange, indigo). The JavaScript functions handle the color change and alert the user with a message about the automatic color change.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2/10/23, 5:13 PM program no.1.

html

Line wrap
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title>
8 </head>
9 <body>
10 <form><h1>
11 CHANGE BACKGROUND COLOR AFTER SOME SECOND AUTOMATICALLY
12 </h1>
13 <input type="button" value="CHANGE BACKGROUNDCOLOR" onmouseover="changeBg()">
14 <input type="button" value="STATUS BAR MASSAGE" onclick="massage()">
15 </form>
16
17
18 <script type="text/javascript">
19 var i=0;
20 var col=new Array("red","yellow","cyan","orange","indigo");
21 function changeBg(){
22 document.body.style.backgroundColor = col[i];
23 i++;
24 if(i>col.length){
25 i=0;
26 }
27 window.setTimeout(changeBg,5000)
28 }
29 window.onload=changeBg();
30
31 function massage(){
32 alert("Atomaticaly change in 7 color")
33 }
34 </script>
35 </body>
36 </html>

view-source:file:///C:/Users/c/Desktop/INFORMATION TECHNOLOGY PRACTICAL PRACTICE FOR 03.02.2023/Javascript program/Program no… 1/1

You might also like