zoukankan      html  css  js  c++  java
  • timer 焦点

    function txtFocus()
            {
                var exp=new Date();
                exp.setTime(exp.getTime() + 60*60*1000);
                document.cookie = "focusTextBox="+ event.srcElement.id + ";expires=" + exp.toGMTString();
            }


               <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnInit="UpdatePanel1_Init">
                    <ContentTemplate>
                    <asp:TextBox runat=server ID=zwei Columns="10" Rows="10" TextMode="MultiLine"></asp:TextBox>
                        <asp:Timer ID="Timer1" runat="server" Interval="5000">
                        </asp:Timer>
                    </ContentTemplate>
                </asp:UpdatePanel>
           
           
            </div>

    protected void Page_Load(object sender, EventArgs e)
        {
            this.zwei.Attributes.Add("onfocus","txtFocus()");
        }
        protected void UpdatePanel1_Init(object sender, EventArgs e)
        {
            if (this.Request.Cookies["focusTextBox"] != null)
            {
                string s = this.Request.Cookies["focusTextBox"].Value;//读出post之前光标停留在哪个TextBox之中
                string script =
                "var inp = $get('" + s + "');" +
                "window.setTimeout('var r = inp.createTextRange();r.collapse(false);r.select();', 10);";
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.Page.GetType(), "ScriptBlock", script, true);
            }

        }

  • 相关阅读:
    Spring Security OAuth2 源码分析
    Spring Security OAuth2 token权限隔离
    Spring Cloud Feign 使用OAuth2
    Spring Security OAuth2 授权码模式
    全链路追踪spring-cloud-sleuth-zipkin
    Spring Security OAuth2 授权失败(401) 问题整理
    使用ShardingJdbc分表
    Kubectl常用命令
    Spring Cloud Zuul实现IP访问控制
    一次非核心接口(信息提示类)被刷引发的思考
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1238791.html
Copyright © 2011-2022 走看看