1.
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <title>标题页</title> 7 <SCRIPT Language="JavaScript"> 8 9 function BgColor() 10 { 11 12 var x = 0, step = 1 //初始化颜色和步长 13 while( x <= 0xffffff) 14 { 15 document.bgColor = x //设置窗体背景色 16 x += step //重新设置颜色 17 step <<= 8 //位的左移-实现颜色的 18 if( step >= 0x1000000) //颜色已经超出范围 19 step = 1 //重新设置步长 20 } 21 } 22 23 </Script> 24 </head> 25 <body bgcolor="#000000" onLoad="BgColor()"> 26 </body> 27 </html>