asp文本框控件的CSS

编程入门 行业动态 更新时间:2024-10-26 16:35:33
本文介绍了asp文本框控件的CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个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 在第一手?您的两个选择器不匹配...

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

本文发布于:2023-11-11 23:49:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579890.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   文本框   asp   CSS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!