<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script type="text/javascript">
    function changeFont(){
    //document.getElementById("table1").style.fontSize="9px";
document.getElementById("table1").style.lineHeight="10px";
}
  </script>
 </head> <body>
<table id = "table1" border=1>
<tr>
<td>111</td>
<td>222</td>
<td>333</td>
</tr>
<tr>
<td>111</td>
<td>222</td>
<td>333</td>
</tr>
</table> 
<input type="button" value="test" onclick="changeFont();"/>
 </body>
</html>刚刚试了一下博主说的问题,测试是没有什么问题的,你看一下是不是引号的问题!!

解决方案 »

  1.   

    //引用jquery,然后写下面的JS
        $("#table1").find("td").css("fontSize", "20px");
        $("#table1").find("td").css("lineHeight", "50px");
      

  2.   

    还要说明下、我之前是用css 设置过table属性的、会不会有冲突呢?
      

  3.   

    <style>
    .table td{
    font-size:9px;
    line-height:10px;
    }
      </style>
      <script type="text/javascript">
            document.getElementById("table1").className = "table";
      </script>