内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

window.top、window.parent、window.open、window.opener

地址:http://blog.csdn.net/zdwzzu2006/article/details/6047632

成都創(chuàng)新互聯(lián)公司服務項目包括當雄網(wǎng)站建設、當雄網(wǎng)站制作、當雄網(wǎng)頁制作以及當雄網(wǎng)絡營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關系等,向廣大中小型企業(yè)、政府機構等提供互聯(lián)網(wǎng)行業(yè)的解決方案,當雄網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務的客戶以成都為中心已經(jīng)輻射到當雄省份的部分城市,未來相信會繼續(xù)擴大服務區(qū)域并繼續(xù)獲得客戶的支持與信任!



在應用有frameset或者iframe的頁面時,parent是父窗口,top是最頂級父窗口(有的窗口中套了好幾層frameset或者iframe),self是當前窗口, opener是用open方法打開當前窗口的那個窗口。

 

window.self

功能:是對當前窗口自身的引用。它和window屬性是等價的。

語法:window.self

注:window、self、window.self是等價的。

 


window.top

功能:返回頂層窗口,即瀏覽器窗口。

語法:window.top

注:如果窗口本身就是頂層窗口,top屬性返回的是對自身的引用。

 

window.parent

功能:返回父窗口。

語法:window.parent

注:如果窗口本身是頂層窗口,parent屬性返回的是對自身的引用。

在框架網(wǎng)頁中,一般父窗口就是頂層窗口,但如果框架中還有框架,父窗口和頂層窗口就不一定相同了。

 

判斷當前窗口是否在一個框架中:

<script type="text/JavaScript">
var b = window.top!=window.self;
document.write( "當前窗口是否在一個框架中:"+b );
</script>

你應當將框架視為窗口中的不同區(qū)域,框架是瀏覽器窗口中特定的部分。一個瀏覽器窗口可以根據(jù)你的需要分成任意多的框架,一個單個的框架也可以分成其它多個框架,即所謂的嵌套框架。

window.open()

https://developer.mozilla.org/en-US/docs/Web/API/Window/open

Loads a resource into either a new browsing context (such as a window) or one that already exists, depending on the specified parameters.

window.top、window.parent、window.open、window.opener

示例

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>window.open()和window.opener</title>
    <script type="text/javascript">
        var winName = "MyWindow";
        var wor = null; // windowObjectReference
        function btnBaiDu(){
            wor = window.open("http://www.baidu.com",winName);
        }
        function btnSina(){
            wor = window.open("http://www.sina.com",winName);
        }
        function btnClose(){
            wor.close();
        }
    </script>
</head>
<body>
    <input type="button" value="打開百度" onclick="btnBaiDu()"/>
    <br/>
    <input type="button" value="打開新浪" onclick="btnSina()"/>
    <br/>
    <input type="button" value="關閉窗口" onclick="btnClose()"/>
</body>
</html>

演示圖

window.top、window.parent、window.open、window.opener

Window.opener

https://developer.mozilla.org/en-US/docs/Web/API/Window/opener

Returns a reference to the window that opened this current window.

window.top、window.parent、window.open、window.opener

示例

window_opener.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>window.opener</title>
    <script type="text/javascript">
        alert("頁面加載!");
        function btnNewWindow(){
            window.open("testWindow.html","test");
        }
    </script>
</head>
<body>
    <input type="button" value="打開新窗口" onclick="btnNewWindow()"/>
</body>
</html>

testWindow.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>測試窗口</title>
    <script type="text/javascript">
        function btnClose(){
            window.opener.location.reload(true);
            window.close();
        }
    </script>
</head>
<body>
    <input type="button" value="關閉當前窗口,并刷新父窗口" onclick="btnClose()"/>
</body>
</html>

演示效果圖

window.top、window.parent、window.open、window.opener

地址:https://developer.mozilla.org/en-US/docs/Web/API/Location/reload

Location.reload()

The Location.reload() method reloads the resource from the current URL. Its optional unique parameter is a Boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.


window.top、window.parent、window.open、window.opener

網(wǎng)站名稱:window.top、window.parent、window.open、window.opener
鏈接地址:http://www.rwnh.cn/article48/peogep.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、靜態(tài)網(wǎng)站外貿(mào)網(wǎng)站建設、微信公眾號App設計、網(wǎng)站策劃

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
沛县| 青龙| 马关县| 南投市| 新兴县| 株洲市| 屯留县| 开化县| 汉阴县| 张家川| 咸阳市| 长乐市| 遂溪县| 丰顺县| 哈密市| 永昌县| 海口市| 陇南市| 唐海县| 大城县| 新昌县| 平湖市| 益阳市| 奇台县| 阿勒泰市| 商都县| 疏勒县| 泾川县| 博爱县| 无极县| 襄垣县| 巴彦淖尔市| 岱山县| 罗江县| 义马市| 荥阳市| 崇礼县| 怀宁县| 常州市| 石林| 台南县|