How to open a page in an iframe

How to open a page in an iframe
Solution:
Just set the link's target attribute value to the same as the target framework name.
Specific steps:
1: For frameset object.
(1) Contains the code of the frame page.

<frameset cols="100,*" name="frame1">
<frame src="1.htm" name="top">
<frame src="2.htm" name="main">
</frameset>

(2) Link code of the frame loading page (1.htm or 2.htm):

<a href="http://www.flash8.net" target="top">Open the link in the upper box</a>
<a href="http://www.flash8.net" target="main">Open the link in the main frame</a>

2. The same usage applies to iframe.

<iframe src="about:blank" name="left"></iframe>
<iframe src="about:blank" name="right"></iframe>
<a href="http://www.flash8.net" target="left">Open the link in the left frame</a>
<a href="http://www.thugx.com" target="right">Open link in right frame</a>

Tip: You can also achieve the same purpose by setting the location property value of the target frame in the script. like:
<a href="http://www.flash8.net"
onClick="document.frames['right'].location=this.href;return false">Open the link in the frame named right</a>

Special note: After running this code, click the link and the link target will be opened in the specified frame or iframe. Figure 1.6.6 shows the effect of the link opening in the specified iframe after clicking the link.

Figure 1.6.6 Open the link target in the specified iframe

Special Notes

This example mainly uses the target attribute of the link and the name attribute of the frame. When the values ​​of the two attributes are the same, the link target is opened in the frame.
target Sets or gets the window or frame in which the target content is to be displayed.
name Sets or gets the name of the frame.

<<:  Sharing ideas on processing tens of millions of data in a single MySQL table

>>:  How to use nginx to configure access to wgcloud

Recommend

A brief discussion on how to use slots in Vue

How to define and use: Use the slot tag definitio...

Implementation of built-in modules and custom modules in Node.js

1. Commonjs Commonjs is a custom module in nodejs...

Detailed explanation of the JVM series memory model

Table of contents 1. Memory model and runtime dat...

How to start Vue project with M1 pro chip

Table of contents introduction Install Homebrew I...

Web project development JS function anti-shake and throttling sample code

Table of contents Stabilization Introduction Anti...

Solve the cross-domain problem of get and post requests of vue $http

Vue $http get and post request cross-domain probl...

jQuery to achieve the barrage effect case

This article shares the specific code of jQuery t...

Implementation of MySQL joint index (composite index)

Joint Index The definition of the joint index in ...

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

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

Common commands for mysql authorization, startup, and service startup

1. Four startup methods: 1.mysqld Start mysql ser...

How to change the domestic source of Ubuntu 20.04 apt

UPD 2020.2.26 Currently Ubuntu 20.04 LTS has not ...

Detailed explanation of type protection in TypeScript

Table of contents Overview Type Assertions in syn...