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

 

//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>

你可能感兴趣的:(how to use javascript to control the usercotrol in the asp.net)