zoukankan      html  css  js  c++  java
  • iframe用法总结

    <iframe>是框架的一种形式,也比较常用到。

      例子1。

    <iframe width=420 height=330 frameborder=0 scrolling=auto src=URL></iframe>

    不用多说了。

      width插入页的宽;height插入页的高;scrolling 是否显示页面滚动条(可选的参数为 auto、yes、no,如果省略这个参数,则默认为auto);frameborder  边框大小;

      注意:URL建议用绝对路径

      传说中百DU用:<iframe width=0 height=0 frameborder=0 scrolling=auto src=WWW .webjx.com></iframe>

    黑了88*8。。。

      例子2。

      如果一个页面里面有框架。。随便点页面里的连接,要求在这个<iframe> 里打开。在iframe 中加入name=** (**自己设定)

    <iframe name=**  ></iframe>

      然后在修改默认打开模式,:网页HEAD中加上<a href=URL target=**>或部分连接的目标框架设为(**)

      例子3。

      要插入一个页面。要求只拿中间一部分。其他的都不要。,。。

      代码:

    <iframe name=123  align=middle marginwidth=0 marginheight=0 vspace=-170 hspace=0 src="http://www.webjx.com/"  frameborder=no scrolling=no  width=776  height=2500></iframe>

      控制插入页被框架覆盖的深度 marginwidth=0 marginheight=0;控制框架覆盖上部分的深度 vspace=-170 

      scrolling滚动条要否(auto、yes、no)   frameborder框架的边框大小,width=776  height=2500此框架的大小。

      例子4.

          在页面中异步加载,google的广告脚本。

         MVC3中的应用;

          <iframe src='@Url.Action("AjaxActionTestJs")' height="310" width="300" frameborder="0" scrolling="auto">
                </iframe>

          Action中所作的处理就是返回对应的视图页,而在视图页面中包含“脚本广告”   

               <script type="text/javascript">
               <!--
                      google_ad_client = "pub-3794392166594766";
                      /* 250x250, 创建于 09-2-11 */
                     google_ad_slot = "8089373421";
                     google_ad_width = 250;
                     google_ad_height = 250;
                //--> 
                </script>
                <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
                </script>
               这样就可以实现加载广告。(需要考虑和纠结的问题,异步加载的脚本会不会被执行!)

         一、页面内加入iframe

    <iframe width=420 height=330 frameborder=0 scrolling=auto src=URL></iframe>,

    scrolling表示是否显示页面滚动条,可选的参数为auto、yes、no,如果省略这个参数,则默认为auto。

      二、超链接指向这个嵌入的网页,只要给这个iframe命名就可以了。方法是<iframe name=**>,例如我命名为aa,写入这句HTML语言<iframe width=420 height=330 name=aa frameborder=0 src=http://www.cctv.com></iframe>,然后,网页上的超链接语句应该写为:<a  href=URL target=aa>

      三、如果把frameborder设为1,效果就像文本框一样

      透明的IFRAME的用法

      必需IE5.5以上版本才支持

      在transparentBody.htm文件的<body>标签中,我已经加入了style="background-color=transparent" 通过以下四种IFRAME的写法我想大概你对iframe背景透明效果的实现方法应该会有个清晰的了解:

    <IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true"></IFRAME> 

    <IFRAME ID="Frame2" SRC="transparentBody.htm" allowTransparency="true" STYLE="background-color: green"> </IFRAME>

    <IFRAME ID="Frame3" SRC="transparentBody.htm"></IFRAME>

    <IFRAME ID="Frame4" SRC="transparentBody.htm" STYLE="background-color: green"> </IFRAME>

     

  • 相关阅读:
    Time Zone 【模拟时区转换】(HDU暑假2018多校第一场)
    HDU 1281 棋盘游戏 【二分图最大匹配】
    Codeforces Round #527 (Div. 3) F. Tree with Maximum Cost 【DFS换根 || 树形dp】
    Codeforces Round #527 (Div. 3) D2. Great Vova Wall (Version 2) 【思维】
    Codeforces Round #527 (Div. 3) D1. Great Vova Wall (Version 1) 【思维】
    Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round 4) C. Connect Three 【模拟】
    Avito Cool Challenge 2018 E. Missing Numbers 【枚举】
    Avito Cool Challenge 2018 C. Colorful Bricks 【排列组合】
    005 如何分析问题框架
    004 如何定义和澄清问题
  • 原文地址:https://www.cnblogs.com/zhangdw/p/2554493.html
Copyright © 2011-2022 走看看