asp文本框控件的CSS [英] CSS of a asp textbox control
问题描述
我有一个ASP文本框控件。当用户关注文本框时,我要将文本框的背景颜色从灰色更改为白色。
I have a ASP text box control. When the user focuses on text box, i want to change the background color of the text box from gray to white.
这里是css文件,
<script language="javascript" type="text-javascript">
function DoFocus(txt)
{
txt.className = 'focus';
}
</script>
文本框
<asp:TextBox ID="txtFirstName" runat="server"
CssClass="textbox" MaxLength="50" Width="188px" onfocus="DoFocus(this)">
CSS
input.textbox, select, textarea
{
font-family : verdana, arial, snas-serif;
font-size : 11px;
color : #000000;
padding : 3px;
background : #f0f0f0;
border-left : solid 1px #c1c1c1;
border-top : solid 1px #cfcfcf;
border-right : solid 1px #cfcfcf;
border-bottom : solid 1px #6f6f6f;
}
input.textbox:focus, input.input_text_focus
{
border-color:#646464;
background-color:#ffcf03;
}
推荐答案
/ strong>我看到你更新了你的帖子,所以澄清:ASP创建一个输入
HTML元素(纠正我,如果我错了),你可以随时通过:focus
选择器在CSS中,不需要Javascript,但也添加 input.textbox:active
捕捉一些buggy IE ...
I saw you updated your post, so to clarify: ASP creates an input
HTML element (correct me if I'm wrong) and you can always style this via the :focus
selector in CSS, no need for Javascript, but also add input.textbox:active
to catch some buggy IE...
input.textbox:focus, input.textbox:active {
/* everything you put here will be aplied to ANY focused input element */
}
$ b b
从您的粘贴代码判断,而不是
Judging from your pasted code, instead of
.input_text:focus, input.input_text_focus {
border-color:#646464;
background-color:#ffffc0;
}
使用
input.textbox:focus, input.input_text_focus {
...
}
或者为什么当你有 input.textbox
input_text >在第一手?您的两个选择器不匹配...
Or why do you suddenly use the class input_text
when you have input.textbox
in the firsthand? Your two selectors don't match...
这篇关于asp文本框控件的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!