这个简单的javascript代码为什么报错(就是用来清空文本框的)
下面的代码为什么报不包含a的定义???   
  <html   xmlns= "http://www.w3.org/1999/xhtml "   >  
  <head   runat= "server ">  
              <title> 无标题页 </title>    
  </head>    
  <script   type= "text/javascript ">  
 function   a() 
 { 
                document.getElementById( 'TextBox1 ').value= " ";           
 }   
  </script>      
  <body>  
              <form   id= "form1 "   runat= "server ">  
              <div>  
                           </div>  
                          <asp:TextBox   ID= "TextBox1 "   runat= "server "> 123 </asp:TextBox>  
                          <asp:Button   ID= "Button1 "   runat= "server "   Text= "Button "   OnClick= "a() "/>  
              </form>  
  </body>  
  </html>  
------解决方案--------------------我也是刚接触.net 的,对服务器控件不是很了解,好象你的onclick事件是在服务器上解析的,但是你写的a()是js是在客户端运行的。所以在服务器控件的事件里找不到函数是可以解释通的。你可以把a写到cs文件中,或者把button换成html控件 
 ============================================================================= 
 .net技术交流群 QQ:8793209,欢迎职业的程序员加入讨论交流!