每当表单值更改时,都会执行 showweeks 函数。它不应该只执行一次 onload 吗?
function showweeks() {
if (document.forms["c_form"]["frequency"].value == "daily") {
document.getElementById("c_dayint").style.backgroundColor = "#ffffff";
} else {
document.getElementById("c_dayint").style.backgroundColor = "#aaaaaa";
}
return;
}
window.onload = function() {
showweeks();
return;
};