现在页面有一个Table控件,现想对它的某个单元格填充文字要如何实现。代码小弟有试着写了点,可是没有达到想要的目的现将我自己写的错误的代码贴出来请各位高手帮忙!<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function inputtable(row)
{
alert(row);
form1.elements[row].item = "123123";
alert(form1.elements[row].item);
return false;
}
function doc()
{
var row;
row = "cel1";
inputtable(row);
alert("end!");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="Table1" runat="server">
<asp:TableRow runat="server" ID="row1">
<asp:TableCell runat="server" ID="cel1" >123</asp:TableCell>
<asp:TableCell runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server"></asp:TableCell>
<asp:TableCell runat="server"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:TextBox ID="T1" runat="server"></asp:TextBox><br />
<input id="Button1" type="button" value="button" onclick="doc()" /></div>
</form>
</body>
</html>
小弟的目的是要对id="cel1"的TableCell控件内的文本原先是123,现想改变这个文本内容,我要怎么办!
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function inputtable(row)
{
alert(row);
form1.elements[row].item = "123123";
alert(form1.elements[row].item);
return false;
}
function doc()
{
var row;
row = "cel1";
inputtable(row);
alert("end!");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="Table1" runat="server">
<asp:TableRow runat="server" ID="row1">
<asp:TableCell runat="server" ID="cel1" >123</asp:TableCell>
<asp:TableCell runat="server"></asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server"></asp:TableCell>
<asp:TableCell runat="server"></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:TextBox ID="T1" runat="server"></asp:TextBox><br />
<input id="Button1" type="button" value="button" onclick="doc()" /></div>
</form>
</body>
</html>
小弟的目的是要对id="cel1"的TableCell控件内的文本原先是123,现想改变这个文本内容,我要怎么办!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货