您的位置:首页 > Web前端 > JavaScript

how to use javascript to control the usercotrol in the asp.net

2010-09-19 15:26 721 查看
 

//test.aspx.cs

protected void Page_Load(object sender, EventArgs e)

        {

          

                TextBox1.Attributes.Add("onclick", "checkt2();");

                TextBox2.Attributes.Add("onclick", "checkt1();");

     }

 

//javascript

 

<script language="javascript">

 function checkt2()

 {

   if(document.getElementById("TextBox2").value!="")

   {

     document.getElementById("TextBox2").value="";

  

   }

 }

 function checkt1()

 {

   if(document.getElementById("TextBox1").value!="")

   {

     document.getElementById("TextBox1").value="";

  

   }

 }

</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息