函数帮忙看看~~
function test0(sl,fjm,fj,csm,cs,pdm,pd,gnm,gn,snm,sn,pmm,pm){
var P_sl,sum
P_sl=parseInt(sl);
var P_fj,P_cs,P_pd,P_gn,P_sn,P_pm
if(P_sl== " "){
return false;
}
else {
if(fjm== " "&&fj== " ")
{P_fj=0;}
else{
P_fj=fj;
P_fj=P_sl*parseInt(P_fj);
}
if(csm== " "&&cs== " ")
{P_cs=0;}
else{
P_cs=cs;
P_cs=P_sl*parseInt(P_cs);
}
if(pdm== " "&&pd== " ")
{P_pd=0;}
else{
P_pd=pd;
P_pd=P_sl*parseInt(P_pd);
}
if(gnm== " "&&gn== " ")
{P_gn=0;}
else{
P_gn=gn;
P_gn=P_sl*parseInt(P_gn);
}
if(snm== " "&&sn== " ")
{P_sn=0;}
else{
P_sn=sn;
P_sn=P_sl*parseInt(P_sn);
}
if(pmm== " "&&pm== " ")
{P_pm=0;}
else{
P_pm=pm;
P_pm=P_sl*parseInt(P_pm);
}
}
return P_fj+P_cs+P_pd+P_gn+P_sn+P_pm;
}
帮忙看看我调用怎么没有返回值呢!
------解决方案--------------------没问题啊,你是不是调用函数的语句不对啊?
<script>
function test0(sl,fjm,fj,csm,cs,pdm,pd,gnm,gn,snm,sn,pmm,pm){
var P_sl,sum
P_sl=parseInt(sl);
var P_fj,P_cs,P_pd,P_gn,P_sn,P_pm
if(P_sl== " "){
return false;
}
else {
if(fjm== " "&&fj== " ")
{P_fj=0;}
else{
P_fj=fj;
P_fj=P_sl*parseInt(P_fj);
}
if(csm== " "&&cs== " ")
{P_cs=0;}
else{
P_cs=cs;
P_cs=P_sl*parseInt(P_cs);
}
if(pdm== " "&&pd== " ")
{P_pd=0;}
else{
P_pd=pd;
P_pd=P_sl*parseInt(P_pd);
}
if(gnm== " "&&gn== " ")
{P_gn=0;}
else{
P_gn=gn;
P_gn=P_sl*parseInt(P_gn);
}
if(snm== " "&&sn== " ")
{P_sn=0;}
else{
P_sn=sn;
P_sn=P_sl*parseInt(P_sn);
}
if(pmm== " "&&pm== " ")
{P_pm=0;}
else{
P_pm=pm;
P_pm=P_sl*parseInt(P_pm);
}
}
return P_fj+P_cs+P_pd+P_gn+P_sn+P_pm;
}
var returnVal=test0(10,11,12,13,14,15,16,17,18,19,20,21,22)
alert(returnVal);
</script>
------解决方案--------------------Click the link to solve your problem.Good luck!