1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

动态改变字体大小

本帖由 greatqsh2005-10-28 发布。版面名称:前端开发

  1. greatqsh

    greatqsh New Member

    注册:
    2005-09-16
    帖子:
    142
    赞:
    1
    <SCRIPT language=javascript>
    function ContentSize(size)
    {
    var obj=document.all.BodyLabel;
    obj.style.fontSize=size+"px";
    }
    </SCRIPT>
    <SPAN id=BodyLabel style="PADDING-RIGHT: 10px; DISPLAY: block; PADDING-LEFT: 10px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px">
    要变化的字体
    </span>
    【 字体:<A href="javascript:ContentSize(16)">大</A>
    <A href="javascript:ContentSize(14)">中</A>
    <A href="javascript:ContentSize(12)">小</A> 】
    _______________________________________________________________________

    <script language="JavaScript" type="text/JavaScript">
    var status0='';
    var curfontsize=10;
    var curlineheight=18;
    function fontZoomA(){
    if(curfontsize>8){
    document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
    document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
    }
    }
    function fontZoomB(){
    if(curfontsize<64){
    document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
    document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
    }
    }
    </script>
     
  2. jcking

    jcking Well-Known Member

    注册:
    2005-08-30
    帖子:
    22,282
    赞:
    70
    好小啊