社区
JavaScript
帖子详情
老问题了
lhdjk
2004-11-01 10:45:32
<table>
<tr><th>var1</th><th>var2</th></tr>
<tr><td><input></td><td><input></td></tr>
当在td最后一个input中输入信息并按下回车后,增加一行
...全文
111
6
打赏
收藏
老问题了
var1var2 当在td最后一个input中输入信息并按下回车后,增加一行
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ttyp
2004-11-01
打赏
举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function addRow(src){
//alert(src);
var newrow = src.insertRow(src.rows.length-1);
newrow.height=20;
var i=4;
while(i--){
var newcell = newrow.insertCell();
switch(i){
case 0: newcell.innerHTML= '<input type="button" onClick="javascript:delRow(this.parentElement.parentElement)" value="删除此行">';break;
default: newcell.innerHTML=div1.innerHTML;break;
}
}
newrow.cells[0].children[0].focus();
}
function delRow(src){
var tab=src.parentElement;
var i=tab.rows.length;
while(i--){
if(src==tab.rows[i]){
alert("就是这行----"+ i);
tab.deleteRow(i);
}
}
}
function nextRow(obj)
{
if(event.keyCode==13)
{
if(obj.cellIndex != 2)
{
event.keyCode = 9;
}
else
{
addRow(obj.parentElement.parentElement);
}
}
}
</script>
</head>
<body>
<table id="tb" width="100%" border="1" align="center" cellpadding="1" cellspacing="1" style="border-collapse:collapse" bordercolor="#111111">
<tr>
<th scope="col" width="25%">奶类</th>
<th scope="col" width="25%">数量</th>
<th scope="col" width="25%">总重</th>
<th scope="col" width="25%">单价</th>
</tr>
<tr id="blankRow" onClick="addRow(this.parentElement)">
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<div id="div1" style="display:none "><input id="txt" type="text" style="width:97%; background-color:#FFFFEF" onkeydown="javascript:return nextRow(this.parentElement)"></div>
</body>
</html>
突击召唤师
2004-11-01
打赏
举报
回复
-__- grammar
突击召唤师
2004-11-01
打赏
举报
回复
This is only a example, just to tell you that your problem can be solved in this way. It is very easy to modify it by yourself, isn't it?
lhdjk
2004-11-01
打赏
举报
回复
师兄,你的两个我都试了,我在table的tr中多加一个<td><input></td>,代码还是在第一个input得到回车后,就换行了。显然还需要改进呀,谢谢
突击召唤师
2004-11-01
打赏
举报
回复
<table>
<tr><td><input onkeypress="addNewLine(this)"></td></tr></table>
<script>
function addNewLine(it) {
if (event.keyCode == 13) {
var thisLine = it;
while (thisLine.tagName != "TR") {
thisLine = thisLine.parentNode;
}
var newLine = thisLine.cloneNode(true);
var inputbox = newLine.firstChild.firstChild
inputbox.value = "";
thisLine.parentNode.appendChild(newLine);
inputbox.focus();
//----------forbid event for other line---
it.onkeypress = null
//----------------------------------------
}
}
</script>
突击召唤师
2004-11-01
打赏
举报
回复
<table>
<tr><td><input onkeypress="addNewLine(this)"></td></tr></table>
<script>
function addNewLine(it) {
if (event.keyCode == 13) {
var thisLine = it;
while (thisLine.tagName != "TR") {
thisLine = thisLine.parentNode;
}
var newLine = thisLine.cloneNode(true);
var inputbox = newLine.firstChild.firstChild
inputbox.value = "";
thisLine.parentNode.appendChild(newLine);
inputbox.focus();
}
}
</script>
eclipse 黑色主题插件 绿色版
一个黑色的Eclipse主题的插件,适合Luna版本以前的
老
版本。 详细配置见我的博客:http://www.cnblogs.com/csulennon/p/4231405.html
《The Swift Programming Language》中文文档
Hi大家好, 鉴于《The Swift Programming Language》中文文档版本繁杂,避免大家因为版本
问题
引起学习不便。@未来眼之
老
码团队 会定期发布最新的中文文档。大家有任何
问题
欢迎垂询! BR OldCoder Team
【spark论文】大型集群上的快速和通用数据处理架构(修正版)
【spark论文翻译】An Architecture for Fast and General Data Processing on Large Cluster 大型集群上的快速和通用数据处理架构。CSDN CODE翻译社区出品。 之前上传的版本图表有
问题
,这版已经修复。请更新谢谢。
一个
老
问题
VS2008程序发布
问题
Release版安装发布包,可以在目录C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\vcredist_x86 下找到vcredist_x86.exe,拷贝到目标机器上安装即可,也可以从微软官网下载 http://www.microsoft.com/en-us/download/search.aspx?q=
解决github打不开
问题
问题
打开GitHub官网,发现打不开,
老
问题
了,动不动就会这样,那就写篇博客记录一下。 思路一 打不开,那是不是dns出了
问题
?github的这个东西它不是一成不变的,失效了换了就是了。 win+r输入cmd ping github.com 查看能不能ping通。如果能那就进入思路二。不能就看下面 更换IP 用dns查询github.com里可用的IP 52.192.72.89 github.com 或者直接用GitHub的https://github.com.ipaddress.com ip
JavaScript
87,997
社区成员
224,709
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章