<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlsns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function changeCont()
{
var num=document.getElementById("select");
var optValue=num.value;
//alert(optValue);
var divCont=document.getElementById("div1");
divCont.style.fontSize=(optValue*10)+'px';
if(optValue==1){document.getElementById("div1").style.color='red';}
if(optValu
JS下拉菜单实现字体大小(实例)
最新推荐文章于 2020-06-05 11:47:24 发布
该博客演示了如何使用JavaScript实现在下拉菜单选择不同选项时,改变网页中指定文字的大小和颜色。通过监听下拉菜单的变更事件,根据所选值动态设置div元素的字体大小和颜色。
摘要由CSDN通过智能技术生成