JAVASCRIPhk点击增表格行

yzdjody 2013-11-20 02:09:19
做一个ASP提交表单。用Button点击来增加一行的INPUT来做输入,如何实现
...全文
440 2 打赏 收藏 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
tony4geek 2013-11-20
  • 打赏
  • 举报
回复
你根据需要改改。
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
var i=0;
  $("button").click(function(){
i++;
    $("p").append("<input type='text'name='' value='"+i+"'/><br/>");
  });
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>在每个 p 元素的结尾添加内容</button>
</body>
</html>
teemai 2013-11-20
  • 打赏
  • 举报
回复

<HTML> 
<TITLE>Form Object example</TITLE> 
<HEAD> 
<script language="javascript"> 
function delrow1() 
{ 
var oElement=event.srcElement; 
while(oElement.tagName!="TR") 
{ 
oElement=oElement.parentElement; 
} 
var oTBody=oElement.parentElement; 
oTBody.removeChild(oElement) 
} 




function delrow2()//刪除当前行 
{ 
var currRowIndex=event.srcElement.parentNode.parentNode.rowIndex; 
document.all.yltable.deleteRow(currRowIndex);//table10--表格id 
} 
function insertrow1() //增加的一行方法1 
{ 
var newnode = document.getElementById('yltable').lastChild.cloneNode(true); 
document.getElementById('yltable').appendChild(newnode); 
} 

function insertrow2() //增加的一行方法2 
{ 
newRow=document.all.yltable.insertRow(-1); 
var j_1 = document.all.yltable.rows.length; 
newcell=newRow.insertCell(); 
newRow.bgColor='#FFFFFF'; 
newcell.align='center'; 
newcell.innerHTML=""+j_1+""; 


newcell=newRow.insertCell() ; 
newRow.bgColor='#FFFFFF'; 

newcell.align='center'; 
newcell.innerHTML="<input type='text' name='ylText"+j_1+"' />"; 


newcell=newRow.insertCell() ; 
newRow.bgColor='#FFFFFF'; 

newcell.align='center'; 

newcell.innerHTML='<input name="button3" type="button" onClick="delrow1()" value="删除1"> <input name="button3" type="button" onClick="delrow2()" value="删除2">'; 

document.all.yltable.focus(); 

} 

function inserttable() 
{ 
var newnode = document.getElementById('yltable').cloneNode(true); 
document.getElementById('ylform').appendChild(newnode); 
} 
</script> 
</HEAD> 
<BODY> 
<form name="ylform" id="ylform"> 
<center> 
<input name="button" type="button" onClick="inserttable()" value="增加表格"> 
  <input name="button2" type="button" onClick="insertrow1()" value="增加一行1"> 
  
<input name="button22" type="button" onClick="insertrow2()" value="增加一行2"> 
</center> 
<table border="1" align="center" width="50%" id="yltable"> 
<TBODY id=yl1> 
<tr> 
<td width="30%" height="22"><div align="center">1</div></td> 
<td width="40%"> 
<div align="center"> 
<input name="textfield" type="text" value="yl"> 
</div></td> 
<td width="30%"><div align="center"> 
<input name="button3" type="button" onClick="delrow1()" value="删除1"> <input name="button3" type="button" onClick="delrow2()" value="删除2"> 
</div></td> 
</tr> 
</TBODY> 
<TBODY id=yl2> 
<tr> 
<td><div align="center">2</div></td> 
<td><div align="center"> 
<input name="textfield2" type="text" value="yanleigis"> 
</div></td> 
<td><div align="center"> 
<input name="button3" type="button" onClick="delrow1()" value="删除1"> <input name="button3" type="button" onClick="delrow2()" value="删除2"> 
</div></td> 
</tr> 
</TBODY> 
<TBODY id=yl3> 
<tr> 
<td ><div align="center">3</div></td> 
<td ><div align="center"> 
<input name="textfield22" type="text" value="Landgis@126.com"> 
</div></td> 
<td ><div align="center"> 
<input name="button3" type="button" onClick="delrow1()" value="删除1"> <input name="button3" type="button" onClick="delrow2()" value="删除2"> 
</div></td> 
</tr> 
</TBODY> 
</table> 
<center> 
</center> 
</form> 
</BODY> 
</HTML> 


【变分多谐波对偶模式追踪】从噪声信号中提取重复瞬态分量的方法(Matlab代码实现)内容概要:本文介绍了“变分多谐波对偶模式追踪”这一信号处理方法,旨在从含有噪声的信号中有效提取重复出现的瞬态成分。该方法结合了变分模态分解与多谐波分析的优势,通过构建对偶模式追踪模型,实现了对微弱瞬态特征的精准分离与增强,特别适用于机械故障诊断、生物医学信号处理等领域。文中详细阐述了算法原理、数学模型构建及其实现步骤,并提供了基于Matlab的代码实现,便于读者复现与应用。; 适合人群:具备一定信号处理基础,从事机械故障诊断、生物医学工程或相关领域的研究生及科研人员。; 使用场景及目标:①从强噪声背景中提取机械设备的周期性冲击信号以进行故障预警;②分析生物医学信号中的重复生理事件,如心电图或脑电图中的特定波形;③为需要高精度瞬态特征提取的研究提供可靠的算法支持与实现范例。; 阅读建议:此资源以Matlab代码实现为核心,不仅展示了算法的具体编程细节,还强调了理论与实践的紧密结合。学习者应在理解算法原理的基础上,动手运行并调试所提供的代码,通过改变参数观察结果变化,从而深入掌握该方法的应用技巧与优化策略。
内容概要:本文围绕“数据驱动下光伏建筑群源荷不确定性解析及其储能多目标低碳经济调度研究”展开,提出了一种融合数据驱动方法与多目标优化算法的综合调度框架。研究首先基于历史数据对光伏发电出力与建筑用电负荷的不确定性进行建模,通过场景生成与削减技术提取典型运行场景,并采用概率预测方法精确刻画源荷波动特征。在此基础上,构建了涵盖经济性、低碳性及系统运行稳定性等多重目标的储能优化调度模型,并引入NSGA-II等先进多目标进化算法求解Pareto最优解集,实现储能系统的协同优化与灵活调度。文中还基于Python语言完整实现了从数据预处理、不确定性建模、优化建模到算法求解的全流程,并通过具体仿真案例验证了所提方法在降低系统运行成本、提升可再生能源消纳水平、减少碳排放等方面的综合效益。; 适合人群:具备一定电力系统基础知识和Python编程能力,从事新能源调度、综合能源系统优化或低碳技术研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于光伏建筑群等分布式能源系统的储能优化调度;②支撑多目标优化在能源系统中的实践,实现经济与环保双重目标的平衡;③为相关课题研究提供可复现的代码框架与技术路线参考。; 阅读建议:建议读者结合文中提供的Python代码,深入理解不确定性建模、场景生成、多目标优化建模与求解的具体实现过程,并可通过调整参数或引入新模型进行拓展研究。

81,108

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧