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

     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

本文标签: javascriptwindowreload() doesn39t reload my pageStack Overflow