js 表格排序并编辑 如何用js进行表格排序和编辑啊,主要是如何进行编辑,具体代码给我吧!!小弟不胜感激。在线等待.... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 以前不懂时到网上搜罗一大圈后写的 <script type="text/javascript"> var input = document.createElement("input"); input.type = "text"; var cell; function editCell(e) { if (e == null) { cell = window.event.srcElement; } else { cell = e.target; } if (cell.tagName == "TD") { input.value = cell.innerHTML; input.onblur = setValue; cell.innerHTML = ""; cell.appendChild(input); input.focus(); } } function setValue() { cell.innerHTML = input.value; } function initEvent() { document.getElementById("editTable").ondblclick = editCell; } </script></head><body onload="initEvent()"> <table id="editTable" border="1"> <tr> <td>哈哈</td> <td>呵呵</td> <td>呜呜</td> </tr> </table></body> 可以使用jquery tablesorter 插件, iframe上传,怎么获取上传后的内容 用回车键提交表chrome下可以用,但是在iE8下面不能用 重写有验证码存在的页面提交时的一些问题 是js版本问题还是《javascript权威指南》写错了 正则判断文件扩展名 javascript能否访问到table下的td中的属性,比如说修改td的背景颜色 如何判断文本框数组 ie6.0中的高度100%没有用,请问怎么解决 js中的三角函数格式是什么样子的? 选择器是变量,怎么获取其下某类元素? 请教个正则表达式的写法 IE缓存影响登陆问题
<script type="text/javascript"> var input = document.createElement("input");
input.type = "text"; var cell;
function editCell(e) {
if (e == null) {
cell = window.event.srcElement;
}
else {
cell = e.target;
}
if (cell.tagName == "TD") { input.value = cell.innerHTML; input.onblur = setValue;
cell.innerHTML = ""; cell.appendChild(input);
input.focus();
}
} function setValue() {
cell.innerHTML = input.value;
}
function initEvent() {
document.getElementById("editTable").ondblclick = editCell;
}
</script></head>
<body onload="initEvent()">
<table id="editTable" border="1">
<tr>
<td>哈哈</td>
<td>呵呵</td>
<td>呜呜</td>
</tr>
</table>
</body>