亲爱的 stackoverflowers,
我想向以下 js 行添加一个变量:
setTimeout("parent.location.href = 'http://www.url.com/lists.php?listid=';",2000);
我该怎么做?我似乎无法得到正确的。
setTimeout("parent.location.href = 'http://www.url.com/lists.php?listid=' + variable;",2000);
最佳答案
最好将函数处理程序传递给 setTimeout()
。此外,它可以轻松解决您的引用问题:
setTimeout(function() {
parent.location.href = "http://www.url.com/lists.php?listid=" + variable;
}, 2000);
关于javascript - 似乎无法将 js 变量添加到parent.href.location,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13068313/