關於窗口的一些小腳本

通常窗口分爲兩種狀況 :html

一、window.open 瀏覽器樣式窗口瀏覽器

  ⑴ 屬性:window.open('index.html', 'newpage', 'height=800, width=60, top=20, left=50, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no') 函數

    參數:window.open 彈出新窗口的命令; 
        'index.html' 彈出窗口的文件名; 
        'newpage'  彈出窗口的名字(不是文件名),非必須,可用空''代替; 
        height=800 窗口高度; 
        width=60    窗口寬度; 
        top=20 窗口距離屏幕上方de 距離; 
        left=50 窗口距離屏幕左側de 距離; 
        toolbar=no/yes 是否顯示工具欄,yes爲顯示; 
        menubar,scrollbars 表示菜單欄和滾動欄。 
        resizable=no/yes 是否容許改變窗口大小,yes爲容許; 
        location=no/yes 是否顯示地址欄,yes爲容許; 
        status=no/yes 是否顯示狀態欄內的信息(一般是文件已經打開),yes爲容許;工具

  ⑵調用父級框函數:window.opener.xx();  xx() 爲父級框de 函數名網站

  ⑶關閉執行函數:window.onbeforeunload = function(){....}ui

二、ifream 模式spa

  ⑴ 屬性:<iframe name="my_iframe" height="540" width="100%" frameborder="0"   marginwidth="0" marginheight="0" scrolling="no" border="0"   src="http://www.33xyx.com" security="restricted"  sandbox="allow-forms allow-scripts allow-same-origin">rest

    參數:code

      1,name id 不用介紹了吧,就是經過關鍵詞來應用操做iframeorm

      2,height width 就是定義iframe的寬度高度,有數字或者百分比

      3,frameborder是否顯示邊框1或0

      4,marginheight marginwidth 定義iframe頂部到底部的邊距 左邊到右邊的邊距

      5,scrolling iframe是否能夠滾動

      6,src="http://www.33xyx.com" 這個你們都知道,替換成本身的網站便可

      7,security="restricted" 我理解就是iframe的東西不能控制父頁面的東西,有人會使用top.location.href=""來控制跳轉,因此本身衡量是否須要加上

      8, sandbox="allow-forms allow-scripts allow-same-origin"把iframe當作一個沙盒模式來使用,容許那些權限,我是容許他提交表單和腳本執行和同源操做

  ⑵ 調用父級框函數:window.parent.window.xx();   變量 :window.parent.window.parentValue;

  ⑶ 父級調用ifream函數:window.frames["iframe_ID"].window.xx();   window.frames["iframe_ID"].window.childValue;

  ⑷ 關閉執行函數:判斷ifream 是否還存在  

相關文章
相關標籤/搜索