IEの適応サイズに適用され、自動的に中央に配置されるダイアログページ(javaScript)
9644 ワード
IEで有効
1
function
AutoSizeWindow() {
2
if
(window.dialogArguments
==
null
) {
3
return
;
//
4
}
5
6
var
_offset
=
new
Object();
7
_offset.height
=
40
;
8
_offset.width
=
40
;
9
_offset.top
=
-
40
;
10
_offset.left
=
0
;
11
_offset.minHeight
=
400
;
12
_offset.minWidth
=
400
;
13
14
var
_myDialog
=
new
Object();
15
_myDialog.height
=
document.body.scrollHeight
+
_offset.height;
16
_myDialog.width
=
document.body.scrollWidth
+
_offset.width;
17
_myDialog.top
=
(
this
.screen.height
-
_myDialog.height)
/
2
+
_offset.top;
18
_myDialog.left
=
(
this
.screen.width
-
_myDialog.width)
/
2
+
_offset.left;
19
20
if
(_myDialog.height
<
_offset.minHeight) _myDialog.height
=
_offset.minHeight;
21
if
(_myDialog.width
<
_offset.minWidth) _myDialog.width
=
_offset.minWidth;
22
23
window.dialogHeight
=
_myDialog.height
+
"
px
"
;
24
window.dialogWidth
=
_myDialog.width
+
"
px
"
;
25
window.dialogTop
=
_myDialog.top
+
"
px
"
;
26
window.dialogLeft
=
_myDialog.left
+
"
px
"
;
27
}