zz用js历遍asp.net页所有控件,把TextBox清空

时间:05/11/2006 16:31:00   作者:ChenReal    阅读:296

public static void TextClear(System.Web.UI.Page p)
{
   string js;
   js  ="<script language='javascript'>";
   js +="var mm = document.getElementsByTagName('input').length ;";
   js +="for(var i=0;i<mm;i++)";
   js +="{";
   js += "var dd = document.getElementsByTagName('input').item(i);";
   js += "if(dd.type == 'text')";
   js +=   "{";
   js +=  "dd.value='';";
   js +=    "}";
   js +="}";
   js +="</scr"+"ipt>";
   p.RegisterStartupScript("ms",js);
}

From:http://ghx88.cnblogs.com/articles/126108.html

 

评论
0/200