求问:这个JS的if和elseif该怎么修改

传递一个参数的时候是正确的,区域这个控件不可用。需求是传递多个参数的时候区域这个控件可用。大佬们帮忙开下这个JS哪里有问题

 

  var test = this.options.form.getWidgetByName('campus_id');

    var thevalue = test.getValue();

    var array = [];

    array = thevalue.split(',');

    // alert(array.length)

    if (array.length <= 1) {

        this.options.form.getWidgetByName('campus_id').setEnable(false);

        this.options.form.getWidgetByName('area').setEnable(false);

        this.options.form.getWidgetByName('department').setEnable(false);

    }

    else if (8<array.length<15)  {

        this.options.form.getWidgetByName('campus_id').setEnable(true);

        this.options.form.getWidgetByName('area').setEnable(false);

        this.options.form.getWidgetByName('department').setEnable(false);

   }

    else if (20<array.length <40) {

        this.options.form.getWidgetByName('campus_id').setEnable(true);

        this.options.form.getWidgetByName('area').setEnable(true);

        this.options.form.getWidgetByName('department').setEnable(false);

}

    else if (array.length>50) {

        this.options.form.getWidgetByName('campus_id').setEnable(true);

        this.options.form.getWidgetByName('area').setEnable(true);

        this.options.form.getWidgetByName('department').setEnable(true);

  }


FineReport Zero丶zero 发布于 2020-11-20 14:19 (编辑于 2020-11-20 14:21)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
1
shirokoLv6资深互助
发布于2020-11-20 14:22

8<a.length<15

这种语法是错的

8<a.length && a.length<15

  • 2关注人数
  • 436浏览人数
  • 最后回答于:2020-11-20 14:22
    请选择关闭问题的原因
    确定 取消
    返回顶部