ITPub博客

首页 > IT职业 > IT图书 > 字体大中小字号选择的另一种方法

字体大中小字号选择的另一种方法

原创 IT图书 作者:chunzhisu 时间:2014-08-02 11:56:29 0 删除 编辑

点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  2. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  3. <head>
  4. <title>字体大中小字号选择的另一种方法</title>
  5. <style type=\"text/css\">
  6. <!--
  7. body {font-size:14px}
  8. -->
  9. </style>
  10. <SCRIPT type=text/javascript>
  11. function $(xixi) {
  12. return document.getElementById(xixi);
  13. }
  14. //转换字号
  15. function doZoom(size){
  16.     if(size==12){
  17.         $(\"contentText\").style.fontSize = size + \"px\";
  18.         $(\"fs12\").style.display = \"\";
  19.         $(\"fs14\").style.display = \"none\";
  20.         $(\"fs16\").style.display = \"none\";
  21.     }
  22.     if(size==14){
  23.         $(\"contentText\").style.fontSize = size + \"px\";
  24.         $(\"fs12\").style.display = \"none\";
  25.         $(\"fs14\").style.display = \"\";
  26.         $(\"fs16\").style.display = \"none\";
  27.     }
  28.     if(size==16){
  29.         $(\"contentText\").style.fontSize = size + \"px\";
  30.         $(\"fs12\").style.display = \"none\";
  31.         $(\"fs14\").style.display = \"none\";
  32.         $(\"fs16\").style.display = \"\";
  33.     }
  34. }
  35. </SCRIPT>
  36. </head>
  37. <body>
  38. <DIV class=fontSize id=fs12 style=\"DISPLAY: none\"><A
  39. href=\"javascript:doZoom(16)\">大</A> <A
  40. href=\"javascript:doZoom(14)\">中</A> <SPAN>小</SPAN></DIV>
  41. <DIV class=fontSize id=fs14><A
  42. href=\"javascript:doZoom(16)\">大</A> <SPAN>中</SPAN> <A
  43. href=\"javascript:doZoom(12)\">小</A></DIV>
  44. <DIV class=fontSize id=fs16 style=\"DISPLAY: none\"><SPAN>大</SPAN> <A
  45. href=\"javascript:doZoom(14)\">中</A> <A
  46. href=\"javascript:doZoom(12)\">小</A></DIV>
  47. <br /><br />
  48. <DIV id=contentText>源码爱好者提供各类编程源码、素材、书籍教程、网页特效代码以及常用软件下载。</DIV>
  49. <p>说明:此方法有别于之前发布的<a href=\"http://www.codefans.net/jscss/code/2607.shtml\" target=\"_blank\">字体大中小代码字号缩放代码</a>,点击链接后,当前字号则不显示链接。</p>
  50. </body>
  51. </html>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29737856/viewspace-1244175/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-04

  • 博文量
    95
  • 访问量
    122215