我知道这是一个讨论很多的问题,但我不知道为什么它对我不起作用。
这是我的功能:
function ShowComments(){
alert("fired");
var movieShareId = document.getElementById('movieId');
//alert("found div" + movieShareId.textContent || movieShareId.innerText);
//alert("redirect location: /comments.aspx?id=" + movieShareId.textContent || movieShareId.innerText + "/");
window.location.href = "/comments.aspx?id=" + movieShareId.textContent || movieShareId.innerText + "/";
var newLocation = window.location;
//alert("full location: " + window.location);
}
如果我没有注释警报,或者如果我打开了 Mozilla 的 bugzilla,它可以正常工作,否则它不会重定向到其他页面。
任何想法为什么?