我确实有以下脚本。它仅在 Chrome 中运行。我无法选中或激活该复选框。如何让它在 FF 和 IE 中运行?
<script type="text/javascript">
function checkHoverButton() {
var lis = document.getElementsByTagName('li');
for( var i = 0, l = lis.length; i < l; i++ ) {
lis[i].onclick = function() {
var c = this.getElementsByTagName('input')[0];
if ( c.checked ){
c.checked = 0;
this.style.background = 'white';
}
else{
c.checked = 1;
this.style.background = '#eceff5';
}
};
}
}
</script>
<li class="friends-li">
<span class="green">
<input type="checkbox" value="<?php echo $value; ?>" id="form_friend_<?php echo $value; ?>" name="form[friend][]" />
</span>
<span class="pink">
<img id="img_friend_<?php echo $value; ?>" src="">
</span>
<span class="blue">
<label for="form_friend_<?php echo $value;?>" ><?php echo $label;?></label>
</span>
</li>