用html写点击超链接弹窗出iframe窗口
以下是一个用HTML编写的点击超链接弹出iframe窗口的示例代码:
<!DOCTYPE html>
<html>
<head>
<title>点击超链接弹出iframe窗口</title>
<style>
/* 样式可以根据自己的需要进行修改 */
#iframeBox {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 60%;
height: 60%;
background-color: #ffffff;
border: 1px solid #000000;
z-index: 9999;
overflow: auto;
}
</style>
</head>
<body>
<!-- 点击该超链接将弹出iframe窗口 -->
<a href="#" onclick="document.getElementById('iframeBox').style.display='block';">点击打开iframe窗口</a>
<!-- iframe窗口 -->
<div id="iframeBox">
<iframe src="https://www.baidu.com"></iframe>
<!-- 点击关闭按钮将关闭iframe窗口 -->
<button onclick="document.getElementById('iframeBox').style.display='none';">关闭</button>
</div>
</body>
</html>
在这个示例中,我们创建了一个超链接,当点击该超链接时,会触发一个JavaScript函数,以显示一个包含iframe的弹窗窗口。当iframe窗口显示时,网页上的其他元素都会被遮挡,并且在关闭按钮被点击时,iframe窗口会被隐藏。
原文地址: http://www.cveoy.top/t/topic/bvLn 著作权归作者所有。请勿转载和采集!