-----------在一个网友给的代码中筛选的---------------
<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>
<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>
解决方案 »
- jQuery 选择器消问题
- js在页面用des加密,密文到后台用java的des解密程序进行解密,请教高人?
- 计时器 内联函数 谷歌 无法使用!求大神指教!
- jquery 对比两个数组返回相同的数据
- ???在iframe中怎样得到鼠标的位置,?????????????
- 紧急!100分。答对就给。不够再加!对于高手问题很简单。对于菜鸟的我……
- 知道rowIndex怎么引用其中的值???
- http://lucky.myrice.com/print.htm这儿没有设置打印纸大小的,怎么办??????快救救我呀。我等了半个月 了。。。
- javascript中怎样去掉字符串前后的空格!
- js切换文字的简单问题求解决
- 当点击select控件,鼠标指针停在select控件的某一个option选项时,触发的什么事件?
- 用showModalDialog打开一个jsp,数据怎么处理
<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>
为什么我得到的分在可用分中没有累加上啊?那得分有什么用嘛?
document.write("<table>……</table>");//最直接!