<html>
<head>
</head>
<body>
<script language="javascript">
function chgColor(obj)
{
   var theTable = document.getElementById("myTable");
   var theTds = theTable.cells;
   for(var i=0;i<theTds.length;i++)
   {
     if(theTds[i]!=obj)
      theTds[i].bgColor="white";
     else
      theTds[i].bgColor="#0069AD"; 
   }
}
</script>
<table id="myTable">
<tr>
<td onclick="chgColor(this);" >&#65404;&#65431;1111111111 </TD> 
<td onclick="chgColor(this);" >&#65426;&#65426;2222222222 </TD> 
<td onclick="chgColor(this);" >&#65393;&#12539;333333333 </TD> 
<td onclick="chgColor(this);" >&#65398;&#65377;4444444444 </TD> 
</tr>
</table>
</body>
</html>如何吧上面的颜色变为字体,这样就可以了!

解决方案 »

  1.   

    <style>
      .sFont{font-size:7pt}
      .bFont{font-size:10pt}
    </style>
    <table>
    <tr bgcolor="#D7EBFF"  class='sFont' onClick="cFont(this);">
        <td >nrothsnow</td>
        <td>塞北的雪</td>
      </tr>
    </table>
    <script language='javascript'>
       function cFont(e){ 
      e.className='bFont';
       }
    </script>
      

  2.   

    style="font-size:10pt"style.fontSize = "20px"
      

  3.   

    我在
    <script language='javascript'>

       function showjyoukenbangou(jyoukenbangou){ 
     document.myform.jyoukenbangou.value=jyoukenbangou;
         document.myform.action = "JyoukenBangou";
     document.myform.submit();
       }
    </script>
    中执行的好像无法执行你们的那个obj!
      

  4.   

    我该在 function showjyoukenbangou(jyoukenbangou)的脚本中怎么加???
      

  5.   

    <body>
    <script language="javascript">
    function chgColor(obj)
    {   
       if(!obj) return;
       obj.style.fontSize="20";  
    }
    </script>
    <table id="myTable">
    <tr>
    <td onclick="chgColor(this);" >&#65404;&#65431;1111111111 </TD> 
    <td onclick="chgColor(this);" >&#65426;&#65426;2222222222 </TD> 
    <td onclick="chgColor(this);" >&#65393;&#12539;333333333 </TD> 
    <td onclick="chgColor(this);" >&#65398;&#65377;4444444444 </TD> 
    </tr>
    </table>
    </body>