• 由内页控制iframe高度宽度


      代码如下:

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    </head>

    <body>
    <IFRAME id="test" name="test" frameBorder=0 scrolling=no src="http://10.107.2.199:2500/cn/asp/reg.asp" width="100%" height=0></IFRAME>
    </body>

    </html>
    <SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">

    document.all("test").height=test.document.body.scrollHeight;

    </SCRIPT>

      重要提示:src=中你必须填写的网页地址,一定要和本页面在同一个站点上,否则,会抱错,说“拒绝访问!”


      之前自己也碰到过这个问题,为了得到答案去网上搜索,发现有不少人也遇到了这样的问题,现在就把解决方法共享一下
    超简单哦

      1、建立一个bottom.js的文件,然后输入下面的代码(只有两行哦)

    parent.document.all("框架ID名").style.height=document.body.scrollHeight;
    parent.document.all("框架ID名").style.width=document.body.scrollWidth;

    这里的 框架ID名 就是Iframe的ID,比如:
    <IFRAME id="框架ID名" name="left" frameBorder=0 scrolling=no src="XXX.asp" width="100%"></IFRAME>

      2、给你网站里所有的被包含文件里面每个都加入
    <script language = "JavaScript" src = "bottom.js"/></script>

      3、OK,收工!
      我在WINXP、IE6下面测试通过。很简单吧!

    本篇文章来源于 站长资讯网 原文链接:http://www.chinahtml.com/0602/xhtml-11394035183429.html

  • 相关阅读:
    hdoj 2063 过山车
    hdoj 2112 HDU Today
    hdoj 1874 畅通工程续
    hdoj 2544 最短路
    sound of the genuine
    复习webpack的常用loader
    node-sass安装报错
    react-debug
    react-router 4v 路由嵌套问题
    React 中使用sass
  • 原文地址:https://www.cnblogs.com/freespider/p/2101723.html
Copyright © 2020-2023  润新知