<!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> <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> </head> <body> <DIV class=fontSize id=fs12 >大 中 <SPAN>小</SPAN></DIV> <DIV class=fontSize id=fs14>大 <SPAN>中</SPAN> 小</DIV> <DIV class=fontSize id=fs16 ><SPAN>大</SPAN> 中 小</DIV> <DIV id=contentText>我是你的玫瑰花</DIV> </body> </html>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]