有挑战性的,if语句判断太繁琐,想改成switch,哪位能帮帮忙 你判断的对象根本不一样,怎么用switch?你这个顶多用三元运算符简写一下... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看错~if(this.speed=="500MHZ"){the_price+=200;}else{the_price+=100;}这样改:switch (this.speed){case "500MHZ":the_price+=200;break;case "45MHZ"://the_price = ...;break;case "350MHZ"://the_price = ....break;case default:break;}其它的同理.. switch (this.speed){case "500MHZ":the_price+=200;break;case "45MHZ"://the_price = ...;break;case "350MHZ"://the_price = ....break;case default:break;} 这样写是不行的,如果行的话怎么能用----挑战----这两个字呢?switch (this.speed){case "500MHZ":the_price+=200;break;case "45MHZ"://the_price = ...;break;case "350MHZ"://the_price = ....break;case default:break;}这样写是不行的,如果行的话怎么能用----挑战----这两个字呢?上面那样的我都试过,都不行, eval("switch (this.speed){case \"500MHZ\":the_price+=200;break;case \"45MHZ\":the_price = ;break;case \"350MHZ\":the_price = ;break;default:break;}"); this.price=get_price;是不是该写为this.price=get_price();因为前者好像是把get_price函数的引用传给this.price。而后者才是运get_price并把结果返回给this.price 谢了,可以用了,不过里面的不太理解,像里面的\"500MHZ\" 反斜杆和引号是什么意思, 请教关于window.external的用法 jquery请求为题 window.event ff问题,急 用js获取源代码的问题 window.onload冲突问题 jqgrid 获取json对象问题 怎麼..打開子窗口再而鎖定父窗口,,而關閉子窗口刷新父窗口???? showModalDialog有时显示不出来!! sos!! javascript交互 怪问题?????? 这两个定义对象是不是一样的? 有在当当买过书的吗?进来讨论一下
if(this.speed=="500MHZ")
{
the_price+=200;
}
else
{
the_price+=100;
}这样改:switch (this.speed)
{
case "500MHZ":
the_price+=200;
break;
case "45MHZ":
//the_price = ...;
break;
case "350MHZ":
//the_price = ....
break;
case default:
break;
}其它的同理..
{
case "500MHZ":
the_price+=200;
break;
case "45MHZ":
//the_price = ...;
break;
case "350MHZ":
//the_price = ....
break;
case default:
break;
}
{
case "500MHZ":
the_price+=200;
break;
case "45MHZ":
//the_price = ...;
break;
case "350MHZ":
//the_price = ....
break;
case default:
break;
}
这样写是不行的,如果行的话怎么能用----挑战----这两个字呢?上面那样的我都试过,都不行,
不过里面的不太理解,像里面的\"500MHZ\" 反斜杆和引号是什么意思,