你如何使用多个选项来url indexOf?

时间:2017-12-14 23:23:39

标签: javascript

我想说的是,如果URL以X结尾,那么我希望将div注入到网站上。但是,有多个X.

var adfc = '$0.00';
if (url.indexOf('YHOPT20T', 'YR20B', 'YR20T') > 0) { {
          adfc = '$10.00';
      }
if (adfc == '$0.00') {
      if (shipsfree == true && returnsfree == true) {
              document.write('<div style="padding-top:12px;"><span class="shipNote">FREE SHIPPING & FREE RETURN</span></div>');
              sizeadviceshow = true;
          }
      else if (shipsfree == true && returnsfree == false) {
              document.write('<div style="padding-top:12px;"><span class="shipNote">FREE SHIPPING</span></div>');
          }
      }
      else {
          document.write('<div style="padding-top:12px;"><span style="font-size:12px; font-weight:normal; color:#AA1E37; cursor:pointer; line-height:18px;">' + adfc + ' Additional Freight Charge</span></div>');
      }

如何完成代码中多个部分的定位?

0 个答案:

没有答案