代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
p {
font-size: 14px;
}
</style>
<body>
<select>
<option class="small">小字体</option>
<option class="middle">中字体</option>
<option class="big">大字体</option>
</select>
<p>
仓库管理系统 阿巴阿巴 二O一一年二月 www.aba-aba.com. 引言
1.1. 编写目的
为了以最小的代价在最短的时间内确定仓库管理系统项目是否值得去开发!
</p>
</body>
<script>
var select = document.querySelector("select");
var p = document.querySelector("p");
select.onclick = function () {
if (select.options[0].selected) {
p.style.fontSize = 14 + "px";
}
if (select.options[1].selected) {
p.style.fontSize = 24 + "px";
}
if (select.options[2].selected) {
p.style.fontSize = 34 + "px";
}
};
</script>
</html>
效果图
![在这里插入图片描述](https://img-blog.csdnimg.cn/a1259f17e39d4bcda5aa0c28098232ab.gif#pic_center)