用document.body.style.fontSize是不行的.
比如表格中的数据就无法改变字体大小.

解决方案 »

  1.   

    <style>
    * {font-Size:12pt;}
    </style>
    <script language="JavaScript">
    function ChangeFontSize(i)
    {
        var oStyleSheet=document.styleSheets[0];
        var oRule=oStyleSheet.rules[0];
        oRule.style.fontSize = i + "pt";
    }
    </script>
    <body>
    <table><tr><td>灰豆宝宝.net</td></tr></table>
    baobao
    <br>
    <input type="button" onclick="ChangeFontSize(9)" value="9pt">
    <input type="button" onclick="ChangeFontSize(10.5)" value="10.5pt">
    </body>