【问题标题】:Mouse Pointer inside the Textbox文本框内的鼠标指针
【发布时间】:2013-10-30 08:52:34
【问题描述】:
我有一个文本框(asp.net),鼠标指针作为手形符号。在为文本框制作textbox 属性Disabled 时,手形符号不显示。(如下代码样式不起作用)。
在将文本框设置为只读时,手形符号正在显示。但是单击文本框时,鼠标指针显示在文本框内。我不想在文本框内看到鼠标指针。
那么我怎样才能使其中任何一个成为可能:
- 如何在单击文本框时避免文本框内的鼠标指针 但必须在鼠标悬停在文本框上时显示手形符号(当文本框处于读取状态时仅)
或
- 如何制作带有手形符号的
textbox.enabled=false。
提前致谢
<style>
.txtclass{cursor:pointer;}
</style
【问题讨论】:
标签:
javascript
asp.net
vb.net
【解决方案1】:
试试这个:-
<style type="text/css">
.myTextBox{cursor:pointer;}
</style>
<asp:TextBox ID="myTextBox" runat="server" disabled="disabled" CssClass="myTextBox"></asp:TextBox>
编辑
我的工作正常。
编辑 2
<style type="text/css">
.myTextBox
{
width: 200px;
margin: 1em auto;
border: 1px solid #ccc;
height: 20px;
background: #ededed;
cursor: pointer;
}
</style>
<div id="myTextBox" class="myTextBox" runat="server">
abs
</div>
【解决方案2】:
试试这个css
input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] {
background-color: #EEEEEE;
cursor: not-allowed;
}
【解决方案3】:
使用两个类
.txtclass1{cursor:default;}
和
.txtclass2{cursor:pointer;}
【解决方案4】:
聪明的孩子,谢谢
通过同时设置 Read only -true 和 Enabled-false 使文本框可见,带有手形符号且没有光标(点击文本框时)
<asp:TextBox ID="txt" CssClass="txtclass" runat="server" Text='<%# DataBinder.Eval (Container.DataItem, "License") %>' Enabled="False" Width="50px" ReadOnly="True"></asp:TextBox>