By using following java script file your page background color change with the time
<html> <head> <script type="text/javascript"> var c=-1; var tmr; ntimer=1000; var ArrColor=new Array(); ArrColor[0]="#d4f0ba"; ArrColor[1]="#badbf0"; ArrColor[2]="#f1bb87"; ArrColor[3]="#de87f1"; ArrColor[3]="#172bbe"; function showpos() { if(c==3) c=0; else c++; if(ntimer<=5) ntimer=1000; else ntimerntimer = ntimer-5; document.body.style.backgroundColor=ArrColor[c]; clearTimeout(tmr); tmr=setTimeout("showpos()", ntimer); } tmr=setTimeout("showpos()", ntimer); </script> </head> <body> <center>Background color change</center> </body> </html> |
By using following java scripts you can also change web page background images also.make folder called"images" and download 3 suitable images for background and rename images as image1.jpg,image2.jpg & image3.jpg
<html> <head> <style> body { margin: 0; padding: 0; background-color: #000; background-image: url('images/image1.jpg'); background-attachment: fixed; background-repeat: no-repeat; background-position: center 0; } .img1 {background-image: url('images/image1.jpg');} .img2 {background-image: url('images/image2.jpg');} .img3 {background-image: url('images/image3.jpg');} </style> <script language="JavaScript1.2"> var inc=1 var numImages=3 function bgSlide() { if(inc > numImages) inc=1 document.body.className="img"+inc inc++ } </script> </head> <body onload="setInterval('bgSlide()',6000)"> </body> </html> |
No comments:
Post a Comment