jQuery——修改网页字体大小

2021-07-03 15:07

阅读:701

标签:字体大小   ==   function   input   back   java   val   ext   jquery   

HTML:

DOCTYPE html>
html>
    head>
        meta charset="UTF-8">
        link type="text/css" href="09.css" rel="stylesheet"/>
        script type="text/javascript" src="jquery.js">script>
        title>title>
    head>
    body>
        h1>wo menh1>
        p>cfjdsmc edvc ewrd csd wrvc d  2e34efrew8r934efc cred  ewfced
        vefwid cfer fd 3ew fcxdwdkjfdke fewf dewkdse fcedwfewdfcs
        fre dfc ed fcejfoklew ferf
        defedefcdp>
        input type="button" id="big" value="放大"/>br />
        input type="button" id="small" value="缩小"/>
        script type="text/javascript">
            $("input").click(function(){
                var t = $("p").css("font-size")
                var t1 = parseInt(t, 10)
                var unit = t.slice(-2)
                var name1 = $(this).attr("id")
                if(name1 == "big"){
                    t1 += 2
                }
                else if(name1 == "small"){
                    t1 -= 2
                }
                $("p").css("font-size", t1+unit)
            })
        script>
    body>
html>

END

jQuery——修改网页字体大小

标签:字体大小   ==   function   input   back   java   val   ext   jquery   

原文地址:http://www.cnblogs.com/sunshine-blog/p/7124097.html


评论


亲,登录后才可以留言!