为了账号安全,请及时绑定邮箱和手机立即绑定

switch case

switch case

瑞若晨曦 2015-12-09 15:34:17
在js文件中使用switch case语句不起作用,改为if else就好使了,什么原因?var option; /* switch(obj._printSelectedOption){ case 1: case 8: option = "_navi"; break; case 2: case 7: option = "_navi_dis"; break; case 4: case 5: option = "_dis"; break; case 10: case 14: option = "_dcl"; break; case 11: case 16: option = "_dcl_dis"; break; case 12: case 15: option = "_navi_dcl"; break; case 13: case 17: option = "_navi_dcl_dis"; break; default: option = ""; break; }*/ if(obj._printSelectedOption ==1 ||obj._printSelectedOption ==8){ option = "_navi"; }else if(obj._printSelectedOption ==2 ||obj._printSelectedOption ==7){ option = "_navi_dis"; }else if(obj._printSelectedOption ==4 ||obj._printSelectedOption ==5){ option = "_dis"; }else if(obj._printSelectedOption ==10 ||obj._printSelectedOption ==14){ option = "_dcl"; }else if(obj._printSelectedOption ==11 ||obj._printSelectedOption ==16){ option = "_dcl_dis"; }else if(obj._printSelectedOption ==12 ||obj._printSelectedOption ==15){ option = "_navi_dcl"; }else if(obj._printSelectedOption ==13 ||obj._printSelectedOption ==17){ option = "_navi_dcl_dis"; }else{ option = ""; }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1103 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信