Iframe使用

Posted 花兮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Iframe使用相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript" src="jquery.min.js"></script>
    <script>
        function changeUrl(){
            $(#showw).show();
            $(#iii).attr(src,http://www.163.com);
        }
        function hs(){
            $(#showw).hide();
        }
    </script>
</head>
<body>
    <a href="javascript:void(0)" onclick="changeUrl()">点击</a><!-- 用过jq操作更换iframe链接 -->
    <a href="http://www.qq.com" target="asdasd">QQ</a><!-- 通过target属性在iframe打开a链接页面 -->
    <div style="width: 1200px;height: 600px;position: fixed;top: 50px;left: 50%;margin-left: -600px;overflow: hidden;" id="showw">
        <span style="position: absolute;top: 0;right: 0;font-size: 20px;cursor: pointer;" onclick="hs()">x</span>
        <iframe name="asdasd" src="https://www.baidu.com" id="iii" frameborder="0" width="98%" height="100%" scrolling="no"></iframe>
    </div>
</body>
</html>

 

以上是关于Iframe使用的主要内容,如果未能解决你的问题,请参考以下文章

从 google-site 上的嵌入式(iframe)片段,引用存储在 google 驱动器上的 json 文件

Google 跟踪代码管理器集成安全性 - noscript iframe 沙盒

拥有的50个CSS代码片段(上)

jQuery 的选择器在 iframe 中不起作用

如何保护来自iframe的Oauth2隐式流

使用 Laravel 作为后端发送 iframe 代码时,Bootstrap 模板中的 Facebook 页面 iFrame 显示问题 [重复]