<form name="form1" method="post" action="">
<input name="a1" type="text" id="a1">
</form>
<table width="100" border="2" cellspacing="0" cellpadding="0">
<tr>
<td onClick="form1.a1.value=this.innerText;" style="cursor:hand ">1114</td>
<td onClick="form1.a1.value=this.innerText;" style="cursor:hand ">454545</td>
</tr>
</table>
<input name="a1" type="text" id="a1">
</form>
<table width="100" border="2" cellspacing="0" cellpadding="0">
<tr>
<td onClick="form1.a1.value=this.innerText;" style="cursor:hand ">1114</td>
<td onClick="form1.a1.value=this.innerText;" style="cursor:hand ">454545</td>
</tr>
</table>
解决方案 »
- 关于Jquery插件的问题?
- 请问动态添加一个js,top.document.body.appendChild和不要top的区别
- 大家帮忙看下这个泡沫提示效果!我添加了setTimeout后,就出现问题了
- javascript中replace用法的问题
- js标本遍历标签后使用innerHTML更改标签的问题
- 关于增加表格行数的问题,在线等,急,急,急!马上给分,谢谢了!
- firefox下如何取得select的name值
- 播放器有一个调进度的滑竿怎么样做呀
- 在线等,网页如何判断客户端是安卓还是IOS系统
- 泛微e-cology8 根据字段值改变单元格颜色
- 怎样禁止页面刷新呢?
- 想做一个javascript读写xml文件的留言板,有没有可能?
这个td元素并不是form容器内的,所以你用this.form.a1是引用不到a1的,既然你已经定义了id,直接引用id名就好了
<td onClick="document.all.a1.value=this.innerText" style="cursor:pointer">1114</td>
<script>
for(i=1;i<5;i++){//suppose the table has 5 rows and each row has 10 cells
document.write("<tr>");
for(i=1;i<10;i++){
document.write("<td onclick='..'></td>");
}
document.write("</tr>");
}
</script>
or you can use php,asp,jsp to create the html pages