<div class="htmlarea"> <textarea id="runcode3767"> <title>实现字体大中小的另一种方法</title> <style type="text/css"> <!-- body {font-size:14px} --> </style> <script type="text/javascript"> function $(xixi) { return document.getElementById(xixi); } //转换字号 function doZoom(size){ if(size==12){ $("contentText").style.fontSize = size + "px"; $("fs12").style.display = ""; $("fs14").style.display = "none"; $("fs16").style.display = "none"; } if(size==14){ $("contentText").style.fontSize = size + "px"; $("fs12").style.display = "none"; $("fs14").style.display = ""; $("fs16").style.display = "none"; } if(size==16){ $("contentText").style.fontSize = size + "px"; $("fs12").style.display = "none"; $("fs14").style.display = "none"; $("fs16").style.display = ""; } } </script> <div class="fontSize" id="fs12" style="DISPLAY: none"> <a href="javascript:doZoom(16)">大</a> <a href="javascript:doZoom(14)">中</a> <span>小</span> </div> <div class="fontSize" id="fs14"> <a href="javascript:doZoom(16)">大</a> <span>中</span> <a href="javascript:doZoom(12)">小</a> </div> <div class="fontSize" id="fs16" style="DISPLAY: none"> <span>大</span> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a> </div> <div id="contentText">我是你的玫瑰花</div> </textarea><br><input onclick="runEx('runcode3767')" type="button" value="运行代码"> <input onclick="doCopy('runcode3767')" type="button" value="复制代码"> <input onclick="doSave(runcode3767)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>