-----------在一个网友给的代码中筛选的---------------
<html>
<head>
<title>Untitled Document</title>
<Script language="JavaScript">
<!--
var Main_Tab = null;
var cur_row = null;
var cur_col = null;
var cur_cell = null;
var Org_con = "";
var sort_col = null;
function add_col(the_table) {
event.cancelBubble=true;
var the_col,i,the_cell;
the_col = cur_col==null?-1:(cur_col+1);
var the_title=prompt("Please input the title: ","Andy");
if(the_title==null)return;
if(the_col!=-1 && the_col<=sort_col && sort_col!=null)sort_col++;
the_title=the_title==""?"Andy":the_title;
for(var i=0;i<the_table.rows.length;i++){
the_cell=the_table.rows[i].insertCell(the_col);
the_cell.innerText=i==0?the_title:("NewCol_" + the_cell.cellIndex);
}
}
//-->
</Script>
<body onload="">
<form name="form1">
<table border="1" id="tab">
<tr>
<td>
Andy
</td>
</tr>
</table>
<input type="button" value="ins_col" onclick="add_col(tab)">
</form>
</body>
</html>

解决方案 »

  1.   

    单击table 表中任意一行,怎样才能把该行号读出来
      

  2.   

    你可真会综合利用你的问题呀????
    <html>
    <head>
    <title>Untitled Document</title>
    <body onload="">
    <form name="form1">
    <table border="1" id="tab">
    <tr onclick="alert('第'+this.id+'行')" id="1">
    <td>
    Andy
    </td>
    </tr>
    <tr onclick="alert('第'+this.id+'行')" id="2">
    <td>
    Andy
    </td>
    </tr>
    <tr onclick="alert('第'+this.id+'行')" id="3">
    <td>
    Andy
    </td>
    </tr>
    <tr onclick="alert('第'+this.id+'行')" id="4">
    <td>
    Andy
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
      

  3.   

    andymu077(明治佐玛戒--秀曼) 
    为什么我得到的分在可用分中没有累加上啊?那得分有什么用嘛?
      

  4.   

    呵呵  有,如何使用javascript创建表
      

  5.   

    败了!
    document.write("<table>……</table>");//最直接!