zoukankan      html  css  js  c++  java
  • .Net中TextBox获得焦点的方法

    <html>
        <head>
    <title>关中游侠——.Net中TextBox获得焦点的方法</title>
        </head>
        <body>
            <form id="Form1" method="post" runat="server">
                .Net中TextBox获得焦点的方法<br />
                <asp:textbox id="txtWords" runat="server" Width="100%" TextMode="MultiLine"></asp:textbox>
                <br />
                更多内容欢迎访问关中游侠的博客:<a href="http://hi.baidu.com/activezfj" title="点击访问" target="_blank">http://hi.baidu.com/activezfj</a>
                <br />
                <!--
                    在这里加入脚本
                -->
           </form>
        </body>
    </html>

    方法一:
            将“在这里加入脚本”替换为:document.Form1.txtWords.focus();

    方法二:
            将“在这里加入脚本”替换为:document.getElementById('<%=txtWords.ClientID%>').focus();

    方法三:  
      CEdit   *p=(CEdit*)GetDlgItem(编辑框的ID);  
      p.SetFocus();  
    方法四:  
      给这个编辑框定义一个CEdit类型的变量,比如m_edit;  
      在需要的地方,用m_edit.SetFocus()就可以了。  
      就可以搞定了

    function text_focus() { window.form1.textbox1.focus(); } 在aspx页面中onload_keydown事件中使用该函数

    Button1.Attributes.Add("onclick",   "javascript:document.all.kongjianId.focus();")

     

  • 相关阅读:
    优先级队列
    内存拷贝
    快速排序
    ubuntu上编译Thrift
    Hadoop 学习总结之一:HDFS简介(zz写的很不错)
    hbase 详细解析(转载)
    HBase技术介绍简介 NOSQL数据库 入门(转载)
    SQL到NOSQL的思维转变
    Hadoop分布式文件系统:架构和设计(zz)
    zz我对技术方向的一些反思
  • 原文地址:https://www.cnblogs.com/0000/p/1601052.html
Copyright © 2011-2022 走看看