foreach (Control c in form1.Controls) { if (c is TextBox) ((TextBox)c).Text = ""; if (c is DropDownList) ((DropDownList)c).SelectedIndex = 0; if (c is RadioButton) ((RadioButton)c).Checked = false; }
function ReSet() { var len=document.form1.elements.length; var i; for (i=0;i<len;i++) { if (document.form1.elements.type=="text") { document.form1.elements.value="";; } if(document.form1.elements.type=="radio") { document.form1.elements.checked=false; } } var obj1=document.getElementById("DlstCallerWay"); var obj5=document.getElementById("TxtRemark"); obj5.value=""; obj1.selectedIndex=0; //不能获得DropDownList 的客户端type,不知道怎么获得的JS没学过。 //当文本框的TextMode设为multiline时也不能获得type就只能一个按照ID获得 }