如题

解决方案 »

  1.   

    写错,是TextBox1.Focus(),反正都试过不行,我在CSDN上看见其他贴子说是可以的啊
      

  2.   

    用的VS.net2003,这个有关系吗?
      

  3.   

    你用sdk写没有加命名空间
    using System.Drawing ; 
    using System.ComponentModel ; 
    using System.Windows.Forms ; 
      

  4.   

    你的不是web程序吧?Focus方法只能用于windows程序的控件
      

  5.   

    放在WEB窗体上的控件不能用焦点吗?
      

  6.   

    我做的WEB程序,System没Windows命名空间啊
      

  7.   

    是不是WEB窗体上不能用控件的Focus方法啊
      

  8.   

    <script language="JavaScript">
    function isNature()    

         
        if (document.Form1.TextBox1.value=="")
        {
         alert("请输入!");
         Form1.TextBox1.focus();
         return false;
        }
        return true;
    }
      

  9.   

    如果是Web应用你需要先获得TextBox的ClientID使用下面的方法获得焦点:
    document.all.TextBox1.focus();如果TextBox不是直接放在页面上,那么最好ClientID可以从服务器端传过来。