zoukankan      html  css  js  c++  java
  • javascript操作frame

    index.html:

    程序代码 程序代码
    <frameset  rows="200,*" cols="*" frameborder="yes" border="1" framespacing="1"  >
        <frame src="up.html" id="topFrame"  name="topFrame" scrolling="yes" />
        <frame src="down.html" id="retFrame" name="retFrame" />
    </frameset>


    up.html:
    程序代码 程序代码
    <input type="text" id="tt" value="11">

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function cssrain(obj){
    document.getElementById("tt").value=obj;
    }
    //-->
    </SCRIPT>


    down.html:
    程序代码 程序代码
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function abc(obj)
    {
    var frm = window.parent.window.frames['topFrame'];
    frm.cssrain(obj); //
    }
    //-->
    </SCRIPT>
    <input type="checkbox" name="check" value="1" onclick="abc(this.value)">1
    <input type="checkbox" name="check" value="2" onclick="abc(this.value)">2
    <input type="checkbox" name="check" value="3" onclick="abc(this.value)">3
    <input type="checkbox" name="check" value="4" onclick="abc(this.value)">4
    <input type="checkbox" name="check" value="5" onclick="parent.topFrame.cssrain(this.value)">5



    总结:
    访问frame或iframe对象时候
    在ie中可以通过frame的id或name来访问,但在firefox中只能用frame的name来访问.
  • 相关阅读:
    C# 基础笔记
    ASP.Net Jquery 随机验证码 文本框判断
    html 随机验证码
    冒泡排序
    工厂方法模式[Factory Mothod]
    单例设计模式[Singleton]
    设计模式之SOLID原则
    linux下配置zookeeper
    linux中安装nginx
    linux安装tomcat
  • 原文地址:https://www.cnblogs.com/luluping/p/1440077.html
Copyright © 2011-2022 走看看