admin管理员组文章数量:1022534
function theLast(){
if (document.getElementById('dont').checked) {
document.getElementById('dont').checked=false;}
else if(document.getElementById('know').checked){
document.getElementById('know').checked=false;}
else if(document.getElementById('master').checked){
document.getElementById('master').checked=false;}
else {
document.getElementById('ans').reset();}
document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.location.reload();
}
i want to reload my page at the end of this function tried window.location.reload() location.reload(true)
is there any other way i can reload my page?
function theLast(){
if (document.getElementById('dont').checked) {
document.getElementById('dont').checked=false;}
else if(document.getElementById('know').checked){
document.getElementById('know').checked=false;}
else if(document.getElementById('master').checked){
document.getElementById('master').checked=false;}
else {
document.getElementById('ans').reset();}
document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.location.reload();
}
i want to reload my page at the end of this function tried window.location.reload() location.reload(true)
is there any other way i can reload my page?
Share Improve this question edited Sep 20, 2016 at 17:50 user663031 asked Sep 20, 2016 at 16:52 RahulRahul 151 gold badge1 silver badge5 bronze badges 10- Possible duplicate of How to reload a page using Javascript? – showdev Commented Sep 20, 2016 at 16:55
-
3
1. Clean up your code. 2. I can’t spot
window.reload
norwindow.location.reload
(which would be correct) anywhere in your code. – idmean Commented Sep 20, 2016 at 16:56 -
I don't see anywhere in the code where you're calling
window.location.reload
. That might be why its not working. – user47589 Commented Sep 20, 2016 at 16:59 -
1
"reloads the resource from the current URL". See
location.reload()
. – showdev Commented Sep 20, 2016 at 17:10 -
1
Fire up your debugger, and place a breakpoint on the
window.location.reload
line. Make sure it reaches there. Then step over the line. Your browser will reload. Most likely, you will find that control never reaches that line, because of some other error in your logic. – user663031 Commented Sep 20, 2016 at 18:53
2 Answers
Reset to default 2I'm not sure about the support for location.reload
but why don't you try this:
window.location.href = window.location.href;
$('#something').click(function() {
location.reload();
});
Add this In Your Script
function theLast(){
if (document.getElementById('dont').checked) {
document.getElementById('dont').checked=false;}
else if(document.getElementById('know').checked){
document.getElementById('know').checked=false;}
else if(document.getElementById('master').checked){
document.getElementById('master').checked=false;}
else {
document.getElementById('ans').reset();}
document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.location.reload();
}
i want to reload my page at the end of this function tried window.location.reload() location.reload(true)
is there any other way i can reload my page?
function theLast(){
if (document.getElementById('dont').checked) {
document.getElementById('dont').checked=false;}
else if(document.getElementById('know').checked){
document.getElementById('know').checked=false;}
else if(document.getElementById('master').checked){
document.getElementById('master').checked=false;}
else {
document.getElementById('ans').reset();}
document.getElementById("pop2").style.display = 'none';
document.getElementById("myPopup").style.display = 'none';
document.getElementById("pop3").style.display = 'none';
document.getElementById("pop4").style.display = 'block';
document.getElementById('pop4').style.position = "absolute";
document.getElementById('pop4').style.top = '250px';
document.getElementById('pop4').style.left = '250px';
setTimeout(function(){
document.getElementById('pop4').className = 'waa';
}, 2500);
window.location.reload();
}
i want to reload my page at the end of this function tried window.location.reload() location.reload(true)
is there any other way i can reload my page?
Share Improve this question edited Sep 20, 2016 at 17:50 user663031 asked Sep 20, 2016 at 16:52 RahulRahul 151 gold badge1 silver badge5 bronze badges 10- Possible duplicate of How to reload a page using Javascript? – showdev Commented Sep 20, 2016 at 16:55
-
3
1. Clean up your code. 2. I can’t spot
window.reload
norwindow.location.reload
(which would be correct) anywhere in your code. – idmean Commented Sep 20, 2016 at 16:56 -
I don't see anywhere in the code where you're calling
window.location.reload
. That might be why its not working. – user47589 Commented Sep 20, 2016 at 16:59 -
1
"reloads the resource from the current URL". See
location.reload()
. – showdev Commented Sep 20, 2016 at 17:10 -
1
Fire up your debugger, and place a breakpoint on the
window.location.reload
line. Make sure it reaches there. Then step over the line. Your browser will reload. Most likely, you will find that control never reaches that line, because of some other error in your logic. – user663031 Commented Sep 20, 2016 at 18:53
2 Answers
Reset to default 2I'm not sure about the support for location.reload
but why don't you try this:
window.location.href = window.location.href;
$('#something').click(function() {
location.reload();
});
Add this In Your Script
本文标签: javascriptwindowreload() doesn39t reload my pageStack Overflow
版权声明:本文标题:javascript - window.reload() doesn't reload my page - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745574301a2156924.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论