Three ways to refresh iframe

Three ways to refresh iframe

Copy code
The code is as follows:

<iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>

Option 1:
Use the iframe's name attribute to locate

Copy code
The code is as follows:

<input type="button" name="Button" value="Button" onclick="document.frames('ifrmname').location.reload()"> or
<input type="button" name="Button" value="Button" onclick="document.all.ifrmname.document.location.reload()">

Option 2:
Use the iframe id attribute to locate

Copy code
The code is as follows:

<input type="button" name="Button" value="Button" onclick="ifrmid.window.location.reload()">

The Ultimate Solution:
When the src of the iframe is another website address (cross-domain operation)

Copy code
The code is as follows:

<input type="button" name="Button" value="Button" onclick="window.open(document.all.ifrmname.src,'ifrmname','')">

<<:  Sample code for implementing 3D rotation effect using pure CSS

>>:  Vuex modularization and namespaced example demonstration

Recommend

In-depth analysis of Flex layout in CSS3

The Flexbox layout module aims to provide a more ...

Delegating Privileges in Linux Using Sudo

Introduction to sudo authority delegation su swit...

Solution to Chinese garbled characters when operating MySQL database in CMD

I searched on Baidu. . Some people say to use the...

HTML table tag tutorial (11): horizontal alignment attribute ALIGN

In the horizontal direction, you can set the alig...

About CSS floating and canceling floating

Definition of Float Sets the element out of the n...

Detailed explanation of how two Node.js processes communicate

Table of contents Preface Communication between t...

Summary of Vue's cross-domain problem handling and solutions

When you send a network request, the following sa...

Install OpenSSL on Windows and use OpenSSL to generate public and private keys

1. OpenSSL official website Official download add...

Example code of javascript select all/unselect all operation in html

Copy code The code is as follows: <html> &l...

Study notes to write the first program of Vue

Table of contents 1. Write an HTML, the first Vue...

JavaScript to achieve a simple magnifying glass effect

There is a picture in a big box. When you put the...

A brief discussion on CSS cascading mechanism

Why does CSS have a cascading mechanism? Because ...

HTML meta viewport attribute description

What is a Viewport Mobile browsers place web page...

Nginx reverse proxy and load balancing practice

Reverse Proxy Reverse proxy refers to receiving t...