日期:2014-05-16  浏览次数:20429 次

这段if语句错在什么地方?
function change1() 

if(document.form1.xxfl.value=="1" || document.form1.xxfl.value=="2")
{
if document.form1.xxfl.value=="1" 
{document.form1.qtgz.options[0]=new Option("-请选择-","");
document.form1.qtgz.options[1]=new Option("11","11");
document.form1.qtgz.options[2]=new Option("12","12");
document.form1.qtgz.length = 2; }
if document.form1.xxfl.value=="2"
{document.form1.qtgz.options[0]=new Option("-请选择-","");
document.form1.qtgz.options[1]=new Option("21","21");
document.form1.qtgz.options[2]=new Option("22","22");
document.form1.qtgz.length = 2;
}
}
else 
{document.form1.qtgz.options[0]=new Option("-请选择-","");
 document.form1.qtgz.length = 1;
document.getElementById("q2").style.display="none"; 
document.getElementById("s2").style.display="none"; 

}

------解决方案--------------------
if document.form1.xxfl.value=="1"
{document.form1.qtgz.options[0]=new Option("-请选择-","");
document.form1.qtgz.options[1]=new Option("11","11");
document.form1.qtgz.options[2]=new Option("12","12");
document.form1.qtgz.length = 2; } 

if 后面加()呀