清除緩存
showModalDialog
參數詳細說明
使用
showModalDialog
顯示數據
,
因為緩存的原因
,
有時候數據不會立即更新
,
所以需要在
HTML
頁面的
Head
標簽內添加使網頁過期的語句
,
這樣才能使
showModalDialog
數據能夠得
到及時的更新:
<meta http-equiv="pragram" content="no-cache">
禁止瀏覽器從本地緩存中調閱頁面。
網頁不保存在緩存中,每次訪問都刷新頁面。
<meta http-equiv="cache-control" content="no-cache, must-revalidate">
網頁不保存在緩存中,必須重新加載頁面
<meta http-equiv="expires" content="0">
網頁在緩存中的過期時間為
0
,一旦網頁過期,必須從服務器上重新訂閱。
基本介紹:
showModalDialog() (IE 4+
支持
)
showModelessDialog() (IE 5+
支持
)
window.showModalDialog()
方法用來創建一個顯示
HTML
內容的模態對話框。
window.showModelessDialog()
方法用來創建一個顯示
HTML
內容的非模態對話框。
使用方法:
vReturnValue
=
window.showModalDialog(sURL
[,
vArguments]
[,sFeatures])
vReturnValue
=
window.showModelessDialog(sURL
[,
vArguments]
[,sFeatures])
參數說明:
sURL--
必選參數,類型:字符串。用來指定對話框要顯示的文檔的
URL
。
vArguments--
可選參數,類型:變體。用來向對話框傳遞參數。傳遞的參數類型不限,包括數組等。
對話框通過
window.dialogArguments
來取得傳遞進來的參數
。
sFeatures--
可選參數,類型:
字符串。用來描述對話框的外觀等信息,
可以使用以下的一個或幾個,
用分號“
;
”隔開。
1.dialogHeight :
對話框高度,不小于100
px
,IE4中
dialogHeight
和
dialogWidth
默認的單位是
em
,
而IE5中是
px
,
為方便其見,
在定義
modal
方式的對
話框時,用
px
做單位。
2.dialogWidth:
對話框寬度。
3.dialogLeft:
離屏幕左的距離。
4.dialogTop:
離屏幕上的距離。
5.center: {yes | no | 1 | 0 }
:
窗口是否居中,
默認
yes
,
但仍可以指定高度和寬度。
6.help: {yes | no | 1 | 0 }
:是否顯示幫助按鈕,默認
yes
。
7.resizable: {yes | no | 1 | 0 }
[IE5+]
:
是否
可被改變大小。默認
no
。
8.status: {yes | no | 1 | 0 }
[
IE5+
]
:是否顯示狀
態欄。默認為
yes[ Modeless]
或
no[Modal]
。
9.scroll:{
yes
|
no
|
1
|
0
|
on
|
off }
:指明對話框是否顯示滾動條。默認為
yes
。
下面幾個屬性是用在
HTA
中的,在一般的網頁中一般不使用。
10.dialogHide:{ yes | no | 1 | 0 | on |
off }
:在打印或者打印預覽時對話框是否隱藏。默認為
no
。
11.edge:{ sunken | raised }
:指明對話框的邊框樣式。默認為
raised
。
12.unadorned:{ yes | no | 1 | 0 | on |
off }
:默認為
no
。
參數傳遞:
1.
要想對話框傳遞參數,
是通過
vArguments
來進行傳遞的。
類型不限制,
對于字符串類
型,最大為
4096
個字符。也可以傳遞對象,例如:
-------------------------------
parent.htm
<script>
var obj = new Object();
obj.name="51js";
window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px");
</script>
modal.htm
<script>
var obj = window.dialogArguments
alert("
您傳遞的參數為:
" + obj.name)
</script>
-------------------------------
2.
可以通過
window.returnValue
向打開對話框的窗口返回信息,
當然也可以是對象。
例
如:
------------------------------
parent.htm
<script>
str
=window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px");
alert(str);
</script>
modal.htm
<script>
posted on 2013-06-05 12:36 youngturk 閱讀(1487) 評論(0) 編輯 收藏 所屬分類: HTML