Asp.net 文本框全选的实现
程序员文章站
2022-06-12 18:28:35
一、鼠标滑过textbox全选 前台:
一、鼠标滑过textbox全选
前台:
<asp:textbox runat="server" onmouseover="this.focus();this.select()">dsdsds</asp:textbox>
或
<asp:textbox runat="server" onmouseover="this.focus()" onfocus="this.select()">dsdsds</asp:textbox>
后台:
this.txtbox1.attributes.add("onmouseover", "this.focus();this.select();");
二、得到焦点
后台:
textbox1.focus();
textbox1.attributes.add("onfocus","this.select()");
前台:
<asp:textbox runat="server" onmouseover="this.focus();this.select()">dsdsds</asp:textbox>
或
<asp:textbox runat="server" onmouseover="this.focus()" onfocus="this.select()">dsdsds</asp:textbox>
后台:
this.txtbox1.attributes.add("onmouseover", "this.focus();this.select();");
二、得到焦点
后台:
textbox1.focus();
textbox1.attributes.add("onfocus","this.select()");
上一篇: Swoole WebSocket 的应用