关于窗口的一些小脚本
一般窗口分為兩種情況 :
1、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')?
參數(shù):window.open 彈出新窗口的命令;?
'index.html' 彈出窗口的文件名;?
'newpage'? 彈出窗口的名字(不是文件名),非必須,可用空''代替;?
height=800 窗口高度;?
width=60? ? 窗口寬度;?
top=20 窗口距離屏幕上方de 距離;?
left=50 窗口距離屏幕左側(cè)de 距離;?
toolbar=no/yes 是否顯示工具欄,yes為顯示;?
menubar,scrollbars 表示菜單欄和滾動欄。?
resizable=no/yes 是否允許改變窗口大小,yes為允許;?
location=no/yes 是否顯示地址欄,yes為允許;?
status=no/yes 是否顯示狀態(tài)欄內(nèi)的信息(通常是文件已經(jīng)打開),yes為允許;
⑵調(diào)用父級框函數(shù):window.opener.xx();? xx() 為父級框de 函數(shù)名
⑶關(guān)閉執(zhí)行函數(shù):window.onbeforeunload?=?function(){....}
2、ifream 模式
⑴ 屬性:<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">
參數(shù):
1,name id 不用介紹了吧,就是通過關(guān)鍵詞來應(yīng)用操作iframe
2,height width 就是定義iframe的寬度高度,有數(shù)字或者百分比
3,frameborder是否顯示邊框1或0
4,marginheight?marginwidth 定義iframe頂部到底部的邊距 左邊到右邊的邊距
5,scrolling iframe是否可以滾動
6,src="http://www.33xyx.com" 這個大家都知道,替換成自己的網(wǎng)站即可
7,security="restricted" 我理解就是iframe的東西不能控制父頁面的東西,有人會使用top.location.href=""來控制跳轉(zhuǎn),所以自己衡量是否需要加上
8,?sandbox="allow-forms allow-scripts allow-same-origin"把iframe當做一個沙盒模式來使用,允許那些權(quán)限,我是允許他提交表單和腳本執(zhí)行和同源操作
⑵ 調(diào)用父級框函數(shù):window.parent.window.xx();? ?變量 :window.parent.window.parentValue;
⑶?父級調(diào)用ifream函數(shù):window.frames["iframe_ID"].window.xx();? ?window.frames["iframe_ID"].window.childValue;
⑷?關(guān)閉執(zhí)行函數(shù):判斷ifream 是否還存在??
轉(zhuǎn)載于:https://www.cnblogs.com/web-snper/p/9996694.html
總結(jié)
以上是生活随笔為你收集整理的关于窗口的一些小脚本的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python特殊函数
- 下一篇: 【第七次JAVA课,java语法基础】课