cellf.setAttribute("style","widthL:30%;font-size:14px;......");

解决方案 »

  1.   

    cellf.setAttribute("style","widthL:30%;font-size:14px;......");
     没有用啊?!还是老样子!
    请赐教!
      

  2.   

    cellf.className="class name you want to use"
      

  3.   

    <html>
    <style>
    .abc{color:red;font-size:50};
    </style>
    <body bgcolor="#FFFFFF">
    <script language="JavaScript">
    <!--function drawTable()

      table=document.getElementById("content_table"); 
      var arrname="name1|name2|name3|name4"
      var arrn=arrname.split("|");
      
      //&Iuml;&euml;&Ocirc;&Uacute;table (id=content_table)&Agrave;&iuml;&Ecirc;&micro;&Iuml;&Ouml;
      //<tr>
        // <td class="label" width="30%">arrn[0]</td>
        //<td  width="70%"><input type="text" name=arrn[n]></td>
      //<tr> 
     //css &Icirc;&Auml;&frac14;&thorn; .label { /* replacement for celllabel,table-cell1,table-cell2,CommmonStatusLabel,td101,td103,td104 */
    // font-size: 14px;
    // font-weight: bold;
    // text-align: left;
    // color: #FFFFFF;
    // background-color:#74A4E6;
    //}
    if(table.childNodes.length>0)
    {
     for (i=0;i<table.childNodes.length;i++)
     {
       var temp = table.childNodes[i];
       table.removeChild(temp);
     }
    }
    for (j=0;j<arrn.length;j++)
    {
     var row=table.insertRow();
     var cellf=row.insertCell();
     cellf.innerHTML=arrn[j];
     cellf.setAttribute("bgColor","#74A4E6");
     cellf.setAttribute("font-size","14px");
     cellf.setAttribute("width","30%");
    cellf.className="abc";
     var cells=row.insertCell();
     cells.innerHTML='<input type="text" name="'+arrn[j]+'">';
     cells.setAttribute("bgColor","#74A4E6");
     cellf.setAttribute("width","70%");
     cellf.className="abc";
    }
    }
    //-->
    </script>
    <table border="0" cellpadding="2" cellspacing="1" id="content_table"></table>
    <button onclick="drawTable()">add</button>
    </body>
    </html>
      

  4.   

    IE里,OK,多谢啊!
    在Netscape 里执行,怎样改才对?