指定a链接在iframe中打开

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LzzMandy/article/details/82114702

可以在a标记的target属性中,指定链接在iframe中打开

1、结果

点击每个链接,在iframe框中显示指向的html内容。

2、源码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title> 列表练习 </title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta charset="utf-8" />
 </head>

 <body>
	<ul type="square">
		<li><a href="1.html" target="frame">指向第1个iframe</a></li>
		<li><a href="2.html" target="frame">指向第2个iframe</a></li>
        <li><a href="3.html" target="frame">指向第3个iframe</a></li>
        <li><a href="4.html" target="frame">指向第4个iframe</a></li>
	</ul>
		<iframe src="1.html" width="100px" height="100px" frameborder="1" scrolling="no" name="frame">第1个iframe</iframe>
 </body>
</html>

猜你喜欢

转载自blog.csdn.net/LzzMandy/article/details/82114702