javacript的小问题 本帖最后由 lddx09831 于 2011-02-24 15:43:10 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考下面:<html><head><script type="text/javascript">function insCell() { var x=document.getElementById('tr2').insertCell(2) x.innerHTML="John" }</script></head><body><table border="1"><tr id="tr1"><th>Firstname</th><th>Lastname</th></tr><tr id="tr2"><td>Peter</td><td>Griffin</td></tr></table><br /><input type="button" onclick="insCell()" value="插入单元"></body></html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>增加Table行</title> </head> <script> function addRow(obj) { //添加一行 var newTr = testTbl.insertRow(); //添加两列 var newTd0 = newTr.insertCell(); var newTd1 = newTr.insertCell(); //设置列内容和属性 newTd0.innerHTML = '<input type=checkbox id="box4">'; newTd1.innerText= '新加行'; } </script> <body> <table id="testTbl" border=1> <tr id="tr1"> <td ><input type=checkbox id="box1"></td> <td id="b">第一行</td> </tr> <tr id="tr2"> <td ><input type=checkbox id="box2"></td> <td id="b">第二行</td> </tr> <tr id="tr3"> <td ><input type=checkbox id="box3"></td> <td>第三行</td> </tr> </table> <br /> <input type="button" id="add" onclick="addRow();" value="Add Row" /> </body></html> 新手求解:使用JSF标签时出错 java 虚拟机和 浏览器 axis webservice的helloworld 使用cos上传报错 有关tomcat5.5数据连接池配置问题。。。 null id 异常报错。。求救 出不来,求解 请大家进来看看? 用的mysql驱动,平常都正常,时间一长就出现socket关闭了,怎么解决这个问题啊 <jsp:include...问题, 关于Java里边session和cookie的问题 急急!
<head>
<script type="text/javascript">
function insCell()
{
var x=document.getElementById('tr2').insertCell(2)
x.innerHTML="John"
}
</script>
</head>
<body><table border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="insCell()" value="插入单元"></body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>增加Table行</title>
</head>
<script>
function addRow(obj)
{
//添加一行
var newTr = testTbl.insertRow();
//添加两列
var newTd0 = newTr.insertCell();
var newTd1 = newTr.insertCell();
//设置列内容和属性
newTd0.innerHTML = '<input type=checkbox id="box4">';
newTd1.innerText= '新加行';
}
</script>
<body>
<table id="testTbl" border=1>
<tr id="tr1">
<td ><input type=checkbox id="box1"></td>
<td id="b">第一行</td>
</tr>
<tr id="tr2">
<td ><input type=checkbox id="box2"></td>
<td id="b">第二行</td>
</tr>
<tr id="tr3">
<td ><input type=checkbox id="box3"></td>
<td>第三行</td>
</tr>
</table>
<br />
<input type="button" id="add" onclick="addRow();" value="Add Row" />
</body>
</html>