【发布时间】:2015-01-16 20:01:32
【问题描述】:
所以这就是我所拥有的 - 我想使用或,但不是 100%。
if(document.location.href.indexOf('test/test/test1') > -1) {
document.location.href = 'http://www.test.com/thank-you';
}
if(document.location.href.indexOf('test/test/test9') > -1) {
document.location.href = 'http://www.test.com/thank-you';
}
会是:
if(document.location.href.indexOf('test/test/test1' || 'test/test/test9') > -1) {
document.location.href = 'http://www.test.com/thank-you';
}
【问题讨论】:
-
RegEx 已失效 - 真实 URL 差异太大(抱歉)。变量很好,但从长远来看会太多。看起来我重复如下所述。我简直不敢相信必须说两次 document.location.href.indexof ()。
标签: javascript jquery redirect