<script language= "JavaScript ">
function submitForm()
{
for (i=1;i=31;i+=1)
{
if (document.form1.cb[i].checked)
{submenuboard[i].style.display= " "}
else
{submenuboard[i].style.display= "none "}
}
}
</script>
小弟想实现的功能为:
循环上面的判断语句
{
if (document.form1.cb1.checked)
{submenuboard1.style.display= " "}
else
{submenuboard1.style.display= "none "}
}
---------------------
{
if (document.form1.cb2.checked)
{submenuboard2.style.display= " "}
else
{submenuboard2.style.display= "none "}
}
---------------------
{
if (document.form1.cb3.checked)
{submenuboard3.style.display= " "}
else
{submenuboard3.style.display= "none "}
}
以此类推!
请各位大侠帮忙!
------解决方案--------------------
试试看
if (eval( "document.form1.cb "+i).checked){
eval( "submenuboard "+i).style.display= " ";
}else{
eval( "submenuboard "+i).style.display= "none ";
}
------解决方案--------------------
//表单this,要全选的对象名,点击按钮对象名
function selectAll(form, obj1, obj2) {
try{
if(form.elements[obj1].length){
for (var i=0; i <form.elements[obj1].length; i++) {
form.elements[obj1][i].checked = obj2.checked;
}
}else{
form.elements[obj1].checked = obj2.checked;
}
}catch(e){}
}
function checkSelect(form, obj1, message, ofocus) {
try{
if(form.elements[obj1].length){
for (var i=0; i <form.elements[obj1].length; i++) {
if (form.elements[obj1][i].checked) return true;
}
if(ofocus != null)form.elements[obj1][0].focus();
}else{
if (form.elements[obj1].checked) return true;
if(ofocus != null)form.elements[obj1].focus();
}
if (!isEmptyNull(message)) {
alert(message);
}
return false;
}catch(e){}
}
function checkSelectAll(form, obj1, message) {//检查是否全选了
try{
var flag = true;
if(form.elements[obj1].length){
for (var i=0; i <form.elements[obj1].length; i++) {
if (!form.elements[obj1][i].checked){
flag = false;
break;
}
}
}else{
if (!form.elements[obj1].checked){
flag = false;
}
}
if (!flag && !isEmptyNull(message)) {
alert(message);
}
return flag;
}catch(e){}
}
------解决方案--------------------
submenuboardX这些是什么?
<script language= "JavaScript ">
function submitForm()
{
for (i=1;i <document.getElementsByName( "cb ").length;i++)
{
if (document.form1.document.getElementsByName( "cb ")[i].checked)
{
document.getElementById( "submenuboard " + i).style.display= " "}
else
{
document.getElementById( "submenuboard " + i).style.display= "none "}
}
}
</script>
------解决方案--------------------
<script language= "JavaScript ">
function submitForm()
{
for (i=1;i=31;i+=1)