偏历页面上的所有TextBox控件
foreach (System.Web.UI.Control control in this.FindControl("form1").Controls)
{
s = control.GetType().ToString();
switch (control.GetType().ToString())
{
case "System.Web.UI.WebControls.TextBox":
(control as TextBox).Text = "";
break;
case "System.Web.UI.WebControls.RadioButton":
(control as RadioButton).Checked = false;
break;
case "System.Web.UI.HtmlControls.HtmlInputText":
(control as HtmlInputText).Value = "";
break;
}
}
javascript:
var inputcollect = document.getElementByTagName("input");
for(var i = 0; i<inputcollect.length; i++)
{
inputcollect[i].value = "";
inputcollect[i].readonly = true;
}