replace(/[0-9]/g,"")
将所有数字替换为空,g表示全局匹配即匹配所有srcElement 事件触发的源,window.event.srcElement
parentElement 其上一级元素,td的上一级为tr,tr的上一级为tbody等
cellIndex td相对其所在tr的索引
rowIndex tr相对其所在tbody(table)的索引
将所有数字替换为空,g表示全局匹配即匹配所有srcElement 事件触发的源,window.event.srcElement
parentElement 其上一级元素,td的上一级为tr,tr的上一级为tbody等
cellIndex td相对其所在tr的索引
rowIndex tr相对其所在tbody(table)的索引
解决方案 »
- JS弹窗的问题
- 当鼠标移动到复选框上的时候,能显示出一个提示...急!急!
- 如何用取字符串与onfocus等功能实现如下网页效果?(有代码更好)
- 急,100分求鼠标跟随的原代码
- #日期处理的加一月加一年的问题
- 谁能给我一段javascript写的urlencode函数啊,要编码UTF-8的汉字的
- [求助难题]:关于下拉框里的数值自动计算并改动的问题。
- 求教,怎么用JScript来实现树的数据结构。
- 请问如何是弹出的窗口没有关闭的按钮。非最大化状态下
- 我在使用window.opener.document.form1.txtmemo.value="test"这段代码时出现“拒绝访问”错误,请问这是为何?
- 用innerHTML如何换行输入
- 200分求一份正则校验的教材!
function document.onclick(){
var e=window.event.srcElement
switch(e.tagName){
case "INPUT":
var i=e.sourceIndex-e.parentElement.sourceIndex
var c=e.parentElement.cellIndex
var r=e.parentElement.parentElement.rowIndex
alert(".rows[" + r + "].cells[" + c + "].children[" + i + "]");
break;
case "TD":
var c=e.cellIndex
var r=e.parentElement.rowIndex
alert(".rows[" + r + "].cells[" + c + "]");
break;
case "TR":
var r=e.rowIndex
alert(".rows[" + r + "]");
}
}
</script>
<table width=915 height="137" id="tab1" border="1">
<tr rowspan=3 align=center class=tr1>
<td width="96" rowspan="3" align="center" height="1">大点</td>
<td rowspan="2" align="center" height="1" width="38">数量合计</td>
<td colspan="7" align="center" height="3" width="314">无周期</td>
<td colspan="2" align="center" height="3" width="98">无周期</td>
<td colspan="5" align="center" height="3" width="280">无周期</td>
<td width="55" rowspan="3" height="1">备注</td>
<tr rowspan=3 align=center class=tr1>
<td colspan="2" align="center" height="1" width="86">无周期</td>
<td colspan="2" align="center" height="1" width="87">无周期</td>
<td colspan="2" align="center" height="1" width="92">无周期</td>
<td width="45" align="center" height="1">无期</td>
<td width="47" align="center" height="1">无期</td>
<td width="46" align="center" height="1">周期</td>
<td width="51" align="center" height="1">无周期</td>
<td width="50" align="center" height="1">无周期</td>
<td width="53" align="center" height="1">无周期</td>
<td width="47" align="center" height="1">无周</td>
<td align="center" height="1" width="59">无周期</td>
<tr rowspan=3 align=center class=tr1>
<td width="38" align="center" height="1">周期</td>
<td width="40" align="center" height="1">周期</td>
<td width="41" align="center" height="1">周期</td>
<td width="41" align="center" height="1">周期</td>
<td width="41" align="center" height="1">周期</td>
<td width="41" align="center" height="1">周期</td>
<td width="46" align="center" height="1">周期</td>
<td width="45" align="center" height="1">周期</td>
<td width="47" align="center" height="1">周期</td>
<td width="46" align="center" height="1">周期</td>
<td width="51" align="center" height="1">周期</td>
<td width="50" align="center" height="1">周期</td>
<td width="53" align="center" height="1">周期</td>
<td width="47" align="center" height="1">周期</td>
<td align="center" height="1" width="59">周期</td>
<tr align=center>
<td width="96" height="26" > 点</td>
<td width="38" height="26" ><input size=5 value="" ></td>
<td width="40" height="26" ><input size=5 value="" ></td>
<td width="41" height="26" > </td>
<td width="41" height="26" ><input size=5 value="" ></td>
<td width="41" height="26" > </td>
<td width="41" height="26" ><input size=5 value="" ></td>
<td width="46" height="26" ><input size=5 value="" ></td>
<td width="45" height="26" > </td>
<td width="47" height="26" ><input size=5 value="" ></td>
<td width="46" height="26" > </td>
<td width="51" height="26" ><input size=6 value="" ></td>
<td width="50" height="26" ><input size=6 value="" ></td>
<td width="53" height="26" ><input size=6 value="" ></td>
<td width="47" height="26" ><input size=5 value="" ></td>
<td width="59" height="26" > </td>
<td width="55" height="26" ><input size=6 value=""></td>
</tr>
<tr align=center>
<td width="96" height="26" > 点</td>
<td width="38" height="26" ><input size=5 value="" ></td>
<td width="40" height="26" ><input size=5 value="" ></td>
<td width="41" height="26" ><input size=5 value="" ></td>
<td width="41" height="26" ><input size=5 value="" ></td>
<td width="41" height="26" > </td>
<td width="41" height="26" ><input size=5 value="" ></td>
<td width="46" height="26" ><input size=5 value="" ></td>
<td width="45" height="26" > </td>
<td width="47" height="26" ><input size=5 value="" ></td>
<td width="46" height="26" > </td>
<td width="51" height="26" ><input size=6 value="" ></td>
<td width="50" height="26" ><input size=6 value="" ></td>
<td width="53" height="26" > </td>
<td width="47" height="26" ><input size=5 value="" ></td>
<td width="59" height="26" ><input size=5 value="" ></td>
<td width="55" height="26" ><input size=6 value=""></td>
</tr>
</table>
srcElement 事件的来源元素
parentElement 父元素
cellIndex 某个单元格在该行内的序号(从0开始)
rowIndex 某一行在表格中的行号(从0开始)
和[0-9]/g 正则表达式,表示0-9这10个字符假如你的表格id=tab1,则
tab1.rows返回一个集合,包含表格中的所有行
tab1.rows(0) 返回表格中的第一行
tab1.rows(0).cells 返回表格中第一行中的单元格的集合
tab1.rows(0).cells(1) 返回第一行第2个单元格
tab1.rows.length表示 表格的行数
tab1.rows(1).cols.length 表格第2行的单元个数