WEB頁子視窗(showModalDialog和showModelessDialog)使用說明_基礎知識

來源:互聯網
上載者:User
使用環境:
  showModalDialog  IE4以上版本
  showModelessDialog  IE5以上
區別:
  showModalDialog  被開啟後就會始終保持輸入焦點。無法操作主視窗,除非關閉對話方塊。
  showModelessDialog  被開啟後,使用者可以隨機切換輸入焦點。只是主視窗被對話方塊擋住。
使用方法:
  vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
  vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])
參數說明:
  sURL   必選參數,類型:字串。用來指定對話方塊要顯示的文檔的URL。
  vArguments  選擇性參數,類型:變體。用來向對話方塊傳遞參數。傳遞的參數類型不限,包括數組等。對話方塊通過window.dialogArguments來取得傳遞進來的參數。
  sURLsFeatures  選擇性參數,類型:字串。用來描述對話方塊的外觀等資訊,可以使用以下的一個或幾個,用分號“;”隔開。
   1.dialogHeight 對話方塊高度,不小於100px,IE4中dialogHeight和dialogWidth 預設的單位是em,而IE5中是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。
   10. dialogHide:{ yes | no | 1 | 0 | on | off }:在列印或者預覽列印時對話方塊是否隱藏。預設為no。
   11. edge:{ sunken | raised }:指明對話方塊的邊框樣式。預設為raised。
   12. unadorned:{ yes | no | 1 | 0 | on | off }:預設為no。
例子:
f.html
複製代碼 代碼如下:

<html>
<head>
<title>主視窗</title>
<script type="text/javascript">
<!--
var child;
function openDialogBox()
{
child = window.showModalDialog('c.html',document.all["txt"],"dialogWidth=500px;dialogHeight=200px;");
}
//-->
</script>
</head>
<body>
<input name="txt" type="text" disabled="disabled" />
<input name="btn" type="button" value="開啟對話方塊" onClick="openDialogBox();" />
</body>
</html>

c.html
複製代碼 代碼如下:

<html>
<head>
<title>對話方塊</title>
<script type="text/javascript">
<!--
function set()
{
window.dialogArguments.value=document.all["txt"].value
}
//-->
</script>
</head>
<body>
<input name="txt" type="text"/>
<input name="btn" type="button" value="設定" onClick="set();" />
</body>
</html>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.