<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function addRow(){
var a=window.document.getElementById("TextBox2").value;
var b=window.document.getElementById("TextBox1").value;
for(j=0;j<parseInt(b);j++)
{
var newTr = testTbl.insertRow(testTbl.rows.length);
//if(j%2==0){newTr.style.background="#FFEFD5";}
for (i=0;i<parseInt(a);i++)
{
var newTd3 = newTr.insertCell();
newTd3.innerHTML = ' IP:<input id="Text1" type="text" />';
if(j%2==0&&i%2==0){newTd3.style.background="#FFE1FF";}
else if(j%2!=0&&i%2!=0) {newTd3.style.background="#FFE1FF";}
}
//var newTd0 = newTr.insertCell();
}
//var newTd1 = newTr.insertCell();
//设置列内容和属性
//if(Count){newTr.style.background="#FFE1FF";}
//else {newTr.style.background="#FFEFD5";}
//newTd0.innerHTML = '<input type=checkbox id="box4">';
//newTd1.innerText="第"+ NO+"行";
}
</script>
</head> <body>
<form id="form1" runat="server">
<table width="100" border="1" cellspacing="1" id="testTbl"
style="border-style: ridge; font-size:14px;"
frame="box" >
</table>
<label>
行:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
列:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<input type="button" value="生成"
onclick="addRow();" id="button0" /></label>
<asp:Button ID="Button1" runat="server" OnClientClick="addRow();" Text="Button" />
</form>
</body> 我想问下为什么我用<input type="button" value="生成"
onclick="addRow();" id="button0" />就可以显示出javascript动态生成的table
用<asp:Button ID="Button1" runat="server" OnClientClick="addRow();" Text="Button" />
则显示不了呢 有没办法使用button也能够显示出table
<title>无标题页</title>
<script type="text/javascript">
function addRow(){
var a=window.document.getElementById("TextBox2").value;
var b=window.document.getElementById("TextBox1").value;
for(j=0;j<parseInt(b);j++)
{
var newTr = testTbl.insertRow(testTbl.rows.length);
//if(j%2==0){newTr.style.background="#FFEFD5";}
for (i=0;i<parseInt(a);i++)
{
var newTd3 = newTr.insertCell();
newTd3.innerHTML = ' IP:<input id="Text1" type="text" />';
if(j%2==0&&i%2==0){newTd3.style.background="#FFE1FF";}
else if(j%2!=0&&i%2!=0) {newTd3.style.background="#FFE1FF";}
}
//var newTd0 = newTr.insertCell();
}
//var newTd1 = newTr.insertCell();
//设置列内容和属性
//if(Count){newTr.style.background="#FFE1FF";}
//else {newTr.style.background="#FFEFD5";}
//newTd0.innerHTML = '<input type=checkbox id="box4">';
//newTd1.innerText="第"+ NO+"行";
}
</script>
</head> <body>
<form id="form1" runat="server">
<table width="100" border="1" cellspacing="1" id="testTbl"
style="border-style: ridge; font-size:14px;"
frame="box" >
</table>
<label>
行:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
列:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<input type="button" value="生成"
onclick="addRow();" id="button0" /></label>
<asp:Button ID="Button1" runat="server" OnClientClick="addRow();" Text="Button" />
</form>
</body> 我想问下为什么我用<input type="button" value="生成"
onclick="addRow();" id="button0" />就可以显示出javascript动态生成的table
用<asp:Button ID="Button1" runat="server" OnClientClick="addRow();" Text="Button" />
则显示不了呢 有没办法使用button也能够显示出table
解决方案 »
- 连接MySQL数据库出错,提示“不知道这样的主机”
- 请教高手我的网站唉本地上运行视频都没问题为什么发布到网上视频就播放不出来?
- 求助 求助 。。。。web.config 配置问题
- 动态CheckBox弹出对话框问题???
- MVC action 返回JavaScript怎么变成了文件下载?
- 判断不出是否安装了Adobe Reader呢?你需要先安装Adobe Reader才能正常浏览文件,请点击这里下载Adobe Reader.就问这几行代码错在哪儿?怎么没有起作用的呢!
- .NET Pet Shop 4.0中的一个问题?ShoppingCartControl.ascx.cs中一些代码看不懂
- 如何在后台更改html页面所有table的borderColorLight直。
- web matrix1.0哪里有下载?
- 一个很简单的问题
- 请教:multipage toolbar在vs2005 developerment server下不好用
- 请问一下 MVC 中 ,我要拼接一个 id 如何拼接呢。
Button1.Attributes.Add("onclick", "javascript:return addRow();");
function addRow() {
alert("aa");
}
$(function () {
$('#MainContent_Button1').click(function (e) {
addRow();
})
});
</script>你在网页上用源文件查看下那个服务器按钮生成的ID是什么。我这边是 MainContent_Button1
protected void Button1_Click(object sender, EventArgs e)
{
Page.RegisterStartupScript("addRow", "<script>addRow()</script>");
}
就能显示了
按照你的写法是要提交页面的,客户端改变的东西,服务器端不知道。