<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    即使世界明天毀滅,我也要在今天種下我的葡萄樹。
    posts - 112, comments - 14, trackbacks - 0, articles - 11

    iframe 父窗口和子窗口的調用方法

    Posted on 2007-01-04 10:44 閱讀(21495) 評論(2)  編輯  收藏 所屬分類: WEB Design
    父窗口調用子窗口
    iframe_ID.iframe_document_object.object_attribute = attribute_value
    例子
    onClick="iframe_text.myH1.innerText='http://www.pint.com';"
    子窗口調用父窗口
    parent.parent_document_object.object_attribute = attribute_value
    例子
    onclick="parent.myH1.innerText='http://www.pint.com';"

    上面在IE下沒有問題,但在firefox下不正常。在firefox下,應該是
    父窗口調用子窗口
    window.frames["iframe_ID"].document.getElementById("iframe_document_object"-).object_attribute = attribute_value
    例子
    window.frames["iframe_text"].document.getElementById("myH1").innerHTML= "http://www.pint.com";
    子窗口調用父窗口
    parent.document.getElementById("parent_document_object").object_attribute = attribute_value
    例子
    parent.document.getElementById("myH1").innerHTML = "http://www.adsf.com";?


    ?子窗口調用父窗口的例子:
    example.htm:
    <html>?
    <body?onclick="alert(tt.myH1.innerHTML)">?
    <Iframe?name="tt"?src="frame1.htm"?width="250"?height="200"?scrolling="no"?frameborder="0"></iframe>?
    <h1?id="myH2">hello,my?wife</h1>?
    </body>?
    </html>?
    frame1.htm
    <body?onload="parent.myH2.innerText='hello,my?friend';"></body>
    父窗口調用子窗口的例子:
    exmaple.htm
    <html>?
    <body?onload="test.myH1.innerText='hello,my?dear';">?
    <Iframe?src="test.htm"?id="test"?width="250"?height="200"?scrolling="no"?frameborder="0"></iframe>?
    </body>?
    </html>?
    test.htm
    <html>?
    <body>?
    <h1?id="myH1">hello,my?boy</h1>?
    </body>?
    </html>

    完整的例子
    test.htm
    代碼:
    <HTML> <HEAD> <TITLE> Test Page </TITLE> <script src="prototype-1.4.0.js"></script> <script language="javascript"> function show(){ window.frames["iframe_text"].document.getElementById("myH1").innerHTML = "http://www.pint.com"; } </script> </HEAD> <BODY> <iframe height="350" width="600" src="iframe_text.htm" name="iframe_text"></iframe> <form action="" method="post"> <input name="haha" id="haha" type="text" maxlength="30" value="haha" /><br /> <textarea cols="50" rows="5" id="getAttributeMethod"></textarea> <input type="button" onClick="show();" value="提交"/> </form> <h1 id="myH1">d</h1> </BODY> </HTML>

    frame_test.htm
    代碼:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>無標題文檔</title> </head> <script language="javascript"> function show(){ parent.document.getElementById("myH1").innerHTML = "http://www.adsf.com"; } </script> <body> <h1 id="myH1">ha</h1> <form action="" method="post"> <input name="abc" id="abc" type="text" maxlength="30" value="abc" /><br /> <textarea cols="50" rows="10" id="text"></textarea> <br /> <input type="button" value="提交" onclick="show();"/> </form> </body> </html>

    Feedback

    # re: iframe 父窗口和子窗口的調用方法   回復  更多評論   

    2007-05-14 12:11 by
    src="iframe_text.htm",我想應該是src="frame_test.htm"
    同樣的錯誤還有。

    # re: iframe 父窗口和子窗口的調用方法 [未登錄]  回復  更多評論   

    2012-09-16 15:13 by 123
    123456789
    主站蜘蛛池模板: 91久久成人免费| 午夜免费福利小电影| 国产成人综合久久精品免费| 亚洲婷婷综合色高清在线| 亚洲免费中文字幕| 亚洲精品中文字幕无码AV| 免费无码一区二区三区| 亚洲美女视频一区二区三区| 波多野结衣在线免费观看| 2020国产精品亚洲综合网| 永久免费毛片手机版在线看| 亚洲成av人片在线天堂无| 在线视频免费国产成人 | 亚洲人成免费电影| 97在线线免费观看视频在线观看 | 色猫咪免费人成网站在线观看| 国产精品亚洲片在线观看不卡| 麻豆精品成人免费国产片| 久久夜色精品国产噜噜噜亚洲AV | 亚洲第一综合天堂另类专| 国产不卡免费视频| 成人免费一区二区三区 | 久久国产亚洲精品| 全部免费国产潢色一级| 美女网站在线观看视频免费的| 亚洲AV成人无码久久精品老人| 国产成人精品免费视| 精品久久久久久亚洲综合网| 亚洲人成网站色在线入口| 黄色网址在线免费| 亚洲人成在线免费观看| 亚洲男人第一无码aⅴ网站| 免费国产叼嘿视频大全网站| 亚洲人成影院77777| 亚洲精品国产精品国自产观看| A片在线免费观看| 亚洲AV无码精品国产成人| 亚洲精品乱码久久久久久按摩| 91免费国产在线观看| 成人特级毛片69免费观看| 亚洲噜噜噜噜噜影院在线播放|