彈出一個指定大小的網(wǎng)頁模式對話框。
本實例主要應(yīng)用 window 對象的 showModalDialog()方法,該方法用于彈出網(wǎng)頁(模式)對話框,其語法如下。
variant = object.showModalDialog(sURL[,vArguments[,sFeatures]])
參數(shù)說明。
參數(shù)說明
| 參數(shù) | 說明 |
|---|---|
| dialogWidth:number | 可選項,用于設(shè)置對話框的寬度。 |
| dialogHeight:number | 可選項,用于設(shè)置對話框的高度。 |
| dialogTop:number | 可選項,用于設(shè)置對話框窗口相對于桌面左上角的 TOP 位置。 |
| dialogLeft:number | 可選項,用于設(shè)置對話框窗口相對于桌面左側(cè)的 Left 位置。 |
| center:{yes|no|1|0} | 可選項,用于指定是否將對話框在桌面上居中,yes|1為居中表示;no|0為不居中顯 示,默認值為yes。 |
| help:{yes|no 1|0} | 可選項,用于指定對話框窗口中是否顯示上下文敏感的幫助圖標(biāo),默認值是 yes。 |
| scroll:{yes|no 1|0} | 可選項,用于指定對話框是否出現(xiàn)滾動條。 |
| resizable:{yes|no 1|0} | 可選項,用于指定對話框窗口大小是否可變,默認值是 no。 |
| status:{yes|no 1|0} | 可選項,用于指定對話框是否顯示狀態(tài)欄。 |
1.實現(xiàn)彈出功能的主頁面 index.html
<html>
<head>
<meta charset="utf-8" />
<script type="text/jscript" language="javascript">
function pp()
{
var someValue = window.showModalDialog("new.html","","dialogWidth=640px;dialogHeight:423px;status=no;help=no;scrollbars=no")
}
</script>
</head>
<body>
<input type="button" value = "彈出" onclick = "pp()">
</body>
</html>
2.彈出的頁面 new.html
<html>
<head>
<meta charset="utf-8" />
<title>彈出的窗口</title>
<style type="text/css">
body{
background-image:url(new.jpg);
background-repeat:no-repeat;
}
</style>
</head>
<body>
</body>
</html>