67,513
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<script type="text/javascript">
function changeColor(){
var cid = document.getElementById("select").value;
if(cid==1){
document.body.bgColor="red";
}
if(cid==2){
document.body.bgColor="yellow";
}
if(cid==3){
document.body.bgColor="blue";
}
}
</script>
<body bgcolor="red">
<select id= "select" onchange="changeColor();">
<option value="1">红</option>
<option value="2">黄</option>
<option value="3">蓝</option>
</select>
</body>
</html>