日期:2014-05-17 浏览次数:20524 次
int nNum = 5;
for (int i = 0; i < nNum; i++)
{
TextBox tx = new TextBox();
tx.ID = "txt" + i;
this.PlaceHolder1.Controls.Add(tx);
}
------解决方案--------------------
给你个列子自己看看吧,网上搜得到的,动态添加
function addNewGoods(){
intTextIndex = intTextIndex + 1 ;
document.getElementById("<% =hidSum.ClientID %>").innerText = intTextIndex;
var textInput="<table class='full4' cellspacing='0' borderColorDark='white' borderColorLight='#a1b5c0' cellpadding='1' border='1' width='100%'><tr>"
+"<td align='left'>姓名</td><td><input type='text' CssClass='tbTextbox' size='20' name='TextName" + intTextIndex + "' id='Text" + intTextIndex + "' /></td>"
+"<td align='left'>工作单位</td><td><input type='text' CssClass='tbTextbox' size='20' name='TextMent" + intTextIndex + "' id='TextNum" + intTextIndex + "' /></td>"
+"<td align='left'>职务</td><td><input type='text' CssClass='tbTextbox' size='20' name='TextType" + intTextIndex + "' id='TextType" + intTextIndex + "' /></td></tr></table>"
document.getElementById('FileList').insertAdjacentHTML("beforeEnd",textInput);
}
------解决方案--------------------