【发布时间】:2013-02-20 08:13:47
【问题描述】:
当用户勾选某些文本旁边的复选框时,我希望文本改变颜色。
这是我的代码:
<p style="color: #FF0000; font-weight: bold;">
I have read and agree to the terms and conditions
<input type="checkbox" id="termsChkbx" />
</p>
这是我目前拥有的功能:
function hasTickedBox( checkBoxID) {
var chkbx = document.getElementById( checkBoxID );
if ( chkbx.checked ) {
//change the font color
} else {
//do nothing
}
}
【问题讨论】:
-
您似乎从未致电
hasTickedBox。您希望触发什么? -
对不起。我希望触发器是用户检查复选框。
-
你试过什么?
标签: javascript