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);
            }

        }

  • 相关阅读:
    elasticsearch的rest搜索---mapping
    elasticsearch的rest搜索--- 安装
    elasticsearch的rest搜索--- 总述
    vs2012代码段,快捷键,snippet 的使用
    Web字体@font-face对于中文字体的使用
    对于VS相关的插件
    作业九 ——报告及总结
    结对编程项目——四则运算
    代码规范、代码复审、PSP
    源程序版本管理软件和项目管理软件
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1238791.html
Copyright © 2011-2022 走看看