1.document.bgColor
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 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 <title>Insert title here</title> 8 </head> 9 <body> 10 <input type="button" value="后退" onClick="history.go(-1)"> 11 <input type="button" value="返回上一步" onClick="history.back(-1)"> 12 13 <input type="button" value="首页" onClick="HomeButton()"> 14 15 <input type="button" value="弹出警告框" onClick="AlertButton()"> 16 17 <input type="button" value="状态信息栏" onClick="StatusButton()"> 18 19 <form> 20 <input type="button" value="背景颜色变化" onclick="Bgbutton()"> 21 </form> 22 </body> 23 <script type="text/javascript"> 24 function HomeButton(){ 25 location.href = "http://localhost:8080/jsTest/1.jsp"; 26 } 27 function AlertButton(){ 28 window.alert("你好你好你好"); 29 } 30 function StatusButton(){ 31 window.status="你好呀你好呀"; 32 } 33 function Bgbutton(){ 34 if(document.bgColor='#ffffff'){ 35 document.bgColor='#00ffff'; 36 }else{ 37 document.bgColor='#ffffff' 38 } 39 } 40 </script> 41 </html>