<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gd2312">
<title>制作我的第一个网页</title>
</head>
<body>
<h1>标题1</h1>
<script language="javascript">
<form name="name1"method="post" action="">
<input name="submit"type="button"value="更换背景颜色"onclick="turncolour();"><!--这是插入一个按键-->
</form>
var arraycolour=new Array("olive","teal","red","blue","maroon","green","yellow"); <!--定义一个颜色数组-->
var n=0;
function turncolour() <!--函数完成颜色变换-->
{
if(n==(arraycolour.length-1)) n=1;
n++;
document.bgColor=arraycolour[n];
}
</script>
</body>
</html>