1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <script type="text/javascript"> 7 window.onload = function(){ 8 var iWeek = 3; 9 var oBody = document.getElementById('body01'); 10 if(iWeek == 1){ 11 oBody.style.backgroundColor = 'gold'; 12 } 13 else if(iWeek == 2){ 14 oBody.style.backgroundColor = 'green'; 15 } 16 else if(iWeek == 3){ 17 oBody.style.backgroundColor = 'pink'; 18 } 19 else if(iWeek == 4){ 20 oBody.style.backgroundColor = 'yellowgreen'; 21 } 22 else if(iWeek == 5){ 23 oBody.style.backgroundColor = 'lightblue'; 24 } 25 else{ 26 oBody.style.backgroundColor = 'lightgreen'; 27 } 28 } 29 </script> 30 </head> 31 <body id="body01"> 32 33 </body> 34 </html>