【发布时间】:2015-06-10 15:23:10
【问题描述】:
我的输入提交按钮有 3 种状态。
- 活动:橙色按钮
- 鼠标按下:深灰色按钮
-
禁用:浅灰色按钮
<input type="submit" id="savebtn" class="save_button"/>
CSS:
save_button {
background: url('/Images/save_button_active.png') no-repeat scroll 0 0 transparent;
cursor: pointer;
font-weight: bold;
font-size: 14px;
height: 33px;
padding-bottom: 4px;
padding-right: 19px;
width: 216px;
border: solid 0px;
color: #fff!important;
background-position: 0px -30px;
}
.save_button-active
{
background:url('/Images/save_button_mousedown.png') no-repeat scroll 0 0 transparent;
cursor: pointer;
font-size:14px;
font-weight: bold;
height: 33px;
padding-bottom: 4px;
padding-right: 19px;
width: 216px;
border:solid 0px;
color:#fff!important;
background-position:0px 2px;
margin-right:20px\0;
}
.save_button[type="submit"]:disabled, .save_button[type="submit"][disabled]
{
background:url('/Images/save_button_disabled.png') no-repeat scroll 0 0 transparent;
cursor: pointer;
font-size:14px;
font-weight: bold;
height: 32px;
padding-bottom: 4px;
padding-right: 19px;
width: 216px;
border:solid 0px;
color:#fff!important;
background-position:0px 1px;
margin-right:20px\0;
}
这适用于 Chrome 和除 IE8 之外的其他 IE 版本,第 3 个禁用状态正在变为橙色和灰色文本。
我正在使用 jquery 添加活动类。
fnMouseDownEvents(buttonObj, mousedownClass, mouseupClass);
我在下面传递了一些东西:
fnMouseDownEvents('save_button', 'save_button-active', 'save_button')
我在 stackoverflow 中搜索了各种解决方案,尝试了不同的解决方案,但都是徒劳的。
我错过了什么吗?
【问题讨论】:
-
我正在使用从 IE8 到 Edge 的版本..!
-
一些疑问..您在上面
css的第一行中缺少.。是错字吗?通过说.save_button-active是添加了一些活动类还是应该是.save_button:active? -
您可能还需要粘贴 html 和 js 的相关代码,向我们展示您是如何添加它的!或者一个 js fiddle 会更有帮助
-
@GuruprasadRao jsfiddle 可以作为问题的补充,但理解问题所需的任何代码都必须在问题本身中。如果 jsfiddle 折叠,我们不能让 JavaScript 标记的一半消失。
-
.save_button[type="submit"][disabled]不是一个有效的选择器,因此整个规则集应该会失败。.save_button[type="submit"]:disabled有效。
标签: jquery html css internet-explorer