page refresh method

1   1, the reload method, which forces the browser to refresh the current page.
2  
3    Syntax: location.reload([bForceGet])
 4  
5    Parameters: bForceGet, optional parameter, the default is false, fetch the current page from the client cache. true, then fetch the latest page from the server in GET mode, which is equivalent to the client clicking F5("refresh")
 6  
7  [html] view plain copy
 8  < script language ="JavaScript" >   
9  window.location.reload( );  
 10  </ script >   
11  
12  In this way, the page is refreshed. Of course, there are other ways. How do we refresh the frame page?
 13  [javascript] view plain copy
 14  //Method 1  
 15    
16  document.getElementById ('FrameID').contentWindow.location.reload(true);  
17   
18   
19 //方法2  
20 document.getElementById('youriframe').src=src;  
21 
22 实例:
23 [html] view plain copy
24 <iframe id="myframe" width="100%" frameBorder="0" src="test.html" scrolling="no"></iframe>  
25 <input type="button" onclick="javascript:refreshFrame();" value="Refresh Frame" />  
26    
27 <script type="text/javascript" >   
28  <!--   
29  function refreshFrame(){  
 30      document.getElementById( ' myframe ' ).contentWindow.location.reload( true );  
 31  }  
 32  // -->   
33  </ script >   
34  
35  two. jQuery implements forced refresh
 36  
37    $('#iframe').attr('src', $('#iframe').attr('src'));
 38  
39  Third, if it is a new page opened, we want to refresh You can use the following code to brush pro
 40  
41  [html] view plain copy
 42  //Refresh the page containing the frame with     
 43  <script language =JavaScript >   
44     parent.location.reload();  
 45  </ script >   
46  //The child window refreshes the parent window  
 47  < script language = JavaScript >   
48      self.opener.location.reload();  
 49  </ script >   
50    (  
 or <a href="javascript:opener.location.reload()"> refresh </a> ) 51 //Refresh another     
 framed page with 52 < script language = JavaScript >    
53     parent.another FrameID.location.reload();  
 54  </ script >   
55  
56Summary  : A lot of document.frames('ifrmname').location.reload() can no longer be used on the Internet
 57 58  
Verify  by yourself59
 60  
In the case of dynamically loading subform content in the page,
 61 62 [javascript] view plain copy
 63 $("#refresh").click(function(){  
 64      parent.location.reload();  
 65 });  
 66 refresh the current Subform
 67 68 [javascript] view plain copy
 69             $("#refresh").click(function() {  
 70                 self.location.reload();  
 71  
      
                });  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324752902&siteId=291194637