背景颜色的改变

<%@ 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=UTF-8">
<title>Insert title here</title>
</head>
<script src="jquery.min.js"></script>
<script type="text/javascript">


function change(col){
$("#one").css({backgroundColor:col});
}
</script>

<body>
bgcolor<select name="s" onchange=change(this.value)>
<option value="white" selected>白色</option>
<option value="#0099CC">粉蓝色</option>
<option value="#F7EED6">米黄色</option>
<option value="black">黑色</option>
</select>
<div id="one">123454564851sadasdsadsfdsfsdfsdfsfffffff<br/>
dsfsdfd
dsfsfsssssssssssss
</div>

</body>
</html>

<%--想要每个页面保持的话需要将值通过sevlet中保存在session中,在其他页面调用--%>

posted @ 2016-03-16 10:52  牙儿  阅读(180)  评论(0)    收藏  举报