javascript - window.reload() doesn't reload my page - Stack Overflow

function theLast(){if (document.getElementById('dont').checked) {document.getElementById('

     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 nor window.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
 |  Show 5 more ments

2 Answers 2

Reset to default 2

I'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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745574302a4633869.html

相关推荐

  • javascript - window.reload() doesn't reload my page - Stack Overflow

    function theLast(){if (document.getElementById('dont').checked) {document.getElementById('

    23小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信