Html复选框:更改颜色 [英] Html CheckBox : Change Color
问题描述
在.NET应用程序的开发过程中,我遇到了一个问题。
我想要做的是更改简单Html复选框的背景颜色,因此我使用了以下HTML代码:
< input type =checkboxid =check1style =背景颜色:黄色/>
此代码仅适用于OPERA,而不适用于其他浏览器(Chrome,Firefox,Explorer) p>
所以我还使用了Javascript代码:
document.getElementById check1)。style.backgroundColor =yellow
和JQuery sintax:
$(#check1)css(background-color,yellow)
但结果是一样的。
如果我使用HTML TextBox, / p>
有人可以帮助我。
a / div>然后改变div的背景颜色。
这样应该是这样:
< div style =background-color:yellow;>
< input type =checkbox/>
< / div>
< div style =background-color:red;>
< input type =checkbox/>
< / div>
< div style =background-color:green;>
< input type =checkbox/>
< / div>
演示。
During the developing of an .NET application I have came across a problem.
What I want to do, is to change the background color of a simple Html checkbox, so I have used the following HTML code:
<input type="checkbox" id="check1" style="background-color: yellow" />
This code works only with OPERA, and not with other browsers (Chrome, Firefox, Explorer)
So i have used also Javascript code:
document.getElementById("check1").style.backgroundColor = "yellow"
and JQuery sintax:
$("#check1").css("background-color", "yellow")
but the result is the same.
This code works if I use an HTML TextBox.
Can someone help me please ??
Wrap each checkbox into a div and then change the div's background-color.
So it should be like this:
<div style="background-color: yellow;">
<input type="checkbox" />
</div>
<div style="background-color: red;">
<input type="checkbox" />
</div>
<div style="background-color: green;">
<input type="checkbox" />
</div>
这篇关于Html复选框:更改颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!