子控件.net
foreach(Control con in this.Controls[1].Controls)//注意
{
if(con is TextBox)
{
this.TextBox1.Text+=con.ID;
}
}
{
if(con is TextBox)
{
this.TextBox1.Text+=con.ID;
}
}
子控件html
for(var i = 0; i<document.all.length; i++)
{
var o = document.all(i);
if(o.tagName == "INPUT"||o.tagName == "input")
alert(o.value);
}
获得属性用 o.getAttribute("id");
{
var o = document.all(i);
if(o.tagName == "INPUT"||o.tagName == "input")
alert(o.value);
}
获得属性用 o.getAttribute("id");
本文介绍如何在.NET和HTML中遍历并获取子控件的ID和值。.NET示例通过foreach循环实现,而HTML示例则使用for循环结合document.all属性来遍历并检查每个元素。
1014

被折叠的 条评论
为什么被折叠?



