![](/img/trans.png)
[英]Why does this return statement in JavaScript return nothing?
[英]If statement does nothing javascript
好的,这是一个我理解但被问到的简单问题......假设你有一个if
语句
if (window.location.href == 'http://' ||
window.location.href == 'http://?pg=pgOldMainMenu' ||
window.location.href == 'http://default.asp#')
else {}
你怎么能说“如果肯定什么都不做,否则加载这个 HTML”?
就这样
var href = window.location.href;
if (href == 'http://' ||
href == 'http://?pg=pgOldMainMenu' ||
href == 'http://default.asp#') {} // do nothing
else {
href = 'url you want to load';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.