Here we have summarized some js methods for refreshing the iframe framework. this method is very simple and practical. if you need it, you can refer to it. Summary of the method for refreshing iframe in javascript. if the following iframe exists, the following N methods are used to refresh the iframe:
The code is as follows:
Method 1: Use the name attribute of iframe to locate
The code is as follows:
Or
The code is as follows:
Method 2: Use the id attribute of iframe to locate
The code is as follows:
Method 3: When the src of iframe is another website address (that is, cross-origin operation)
The code is as follows:
The parent page contains two iframe, one of which is a link list. the link points to another iframe, which is used to display the content. Now, when the content is added and a record is added to the link list, you need to refresh the list iframe.
Use parent in the submitted js of the content iframe. location. reload () refreshes all the parent pages. because the other iframe does not have a default url and can only be selected through the list, only the content of the list iframe is displayed.
Use window. parent. frames ["list iframe name"]. location = "list url" to refresh the list iframe. after the content iframe is submitted, its own refresh will not be affected.
The code is as follows:
Document. frames ("refreshAlarm"). location. reload (true );
Document. frames ("refreshAlarm" 2.16.doc ument. location. reload (true );
Document. frames ("refreshAlarm" 2.16.doc ument. location = "http://www.jb51.net /";
Document. frames ("refreshAlarm"). src = "http://www.jb51.net /";
Note: document. all. refreshAlarm or document. frames ("refreshAlarm") returns the iframetag in http://www.jb51.net/page, which is useful for srcworkflow operations.
Document. frames ("refreshAlarm" ).doc ument get the content in iframe, that is, the content in "http://www.jb51.net.
Summary of implementation methods for automatically refreshing pages in javascript (js:
Refresh every 10 seconds. add the following code segment to the head tab of the page:
The code is as follows:
Regularly refresh the page (refresh the page every 2 seconds ):
The code is as follows: