<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>设置字体背景颜色,大小</title>
<style>
.k1{
height:10px;
width:10px;
border:1px #00F solid;
margin:2px;
float:right;
cursor:pointer;
}
span{
cursor:pointer;
}
</style>
<script language="javascript" type="text/javascript">
/*
思路:
1、先制定出一些小的颜色区块
*/
function changeColor(color){
//设置背景颜色
document.bgColor=color;
}
function changeSize(size){
//获取div对象
document.getElementById("content").style.fontSize=size+"px";
}
</script>
</head>
<body>
<div class="k1" style="background-color:#FFC"
onclick="changeColor('#ffffcc')"></div>
<div class="k1" style="background-color:#FCC"
onclick="changeColor('#ffcccc')"></div>
<div class="k1" style="background-color:#F9C"
onclick="changeColor('#ff99cc')"></div>
<span onclick="changeSize(26)">大</span>
<span onclick="changeSize(16)">中</span>
<span onclick="changeSize(14)">小</span>
<hr style="clear:both">
<div id="content">
关于四级的通过宝典<br>
三短一长,选短的,三段一长。选长的;长短布衣要选B,层次不齐要选D;
沂蒙为主,以抄为主,蒙抄结合,四级必过!
</div>
</body>
</html>