window.onload = function () { var arr = document.getElementsByTagName("INPUT"); for (var i = 0; i < arr.length; i++) { if (arr[i].checked) { if (arr[i].type == "radio") { arr[i].style.backgroundColor = "red"; } else { arr[i].style.backgroundColor = ""; } } else { arr[i].style.backgroundColor = ""; } } }
为大家附3个精彩的专题: