注册 登录
编程论坛 ASP.NET技术论坛

ASP.net怎么实现鼠标经过TextBox,TextBox中的内容处理选中状态

zhanwenfu 发布于 2008-09-27 19:18, 2364 次点击
怎么实现鼠标经过TextBox,TextBox中的内容处理选中状态!!!如下图呀`
VS2003的方法和VS2005的方法都行呀...请高手帮忙呀~~~
7 回复
#2
hellson2008-09-28 10:29
        void TextBox1MouseEnter(object sender, System.EventArgs e)
        {
            textBox1.SelectAll();
        }
#3
606liutong2008-09-28 14:16
LS正解。。。

#4
cxwl3sxl2008-09-28 18:55
楼上的楼上的方法是服务器端的哦!想asp。net这样的最好还是用js实现,个人感觉要好些
#5
frankqnj2008-09-29 04:05
.net  2.0开始 貌似 没有selectall() 方法

用 attributes.add() 给控件添加属性  就实现了
#6
笑看人生活快乐2008-10-03 21:53
js实现很简单
#7
zsf20062008-10-05 13:17
页面:
<div>
        <asp:TextBox ID="TextBox1" runat="server" Text="鼠标移上试试" ></asp:TextBox>
        <br />
        <input id="Text1" type="text" value="鼠标移上试试"  onmousemove="this.select()"/>
    </div>

代码:
this.TextBox1.Attributes.Add("onMouseOver", "this.select()");
#8
zhanwenfu2008-10-05 14:13
谢谢了...是呀..会加强服务器的负担呀..JS代码如何呢???或javascript也会吧..
1