始终在最前面的弹出窗口对话框<转>
1<html>
2
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
5<title>网页特效代码|JsCode.CN|---始终在最前面的弹出窗口对话框</title>
6</head>
7
8<body>
9<SCRIPT>
10function fnRandom(iModifier){
11return parseInt(Math.random()*iModifier);
12}
13function fnSetValues(){
14var iHeight=oForm.oHeight.options[
15oForm.oHeight.selectedIndex].text;
16if(iHeight.indexOf("Random")>-1){
17iHeight=fnRandom(document.body.clientHeight);
18}
19var sFeatures="dialogHeight: " + iHeight + "px;";
20return sFeatures;
21}
22function fnOpen(){
23var sFeatures=fnSetValues();
24window.showModalDialog("showModalDialog_target.htm", "",
25sFeatures)
26}
27</SCRIPT>
28<FORM NAME=oForm>
29窗口高度: <SELECT NAME="oHeight">
30<OPTION>-- 随机 --
31<OPTION>150
32<OPTION>200
33<OPTION>250
34<OPTION>300
35</SELECT>
36打开窗口:
37<INPUT TYPE="button" VALUE="打开窗口"
38onclick="fnOpen()">
39</FORM>
40</body>
41
42</html>
效果演示http://www.jscode.cn/JsHtml/Js659.htm
2
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
5<title>网页特效代码|JsCode.CN|---始终在最前面的弹出窗口对话框</title>
6</head>
7
8<body>
9<SCRIPT>
10function fnRandom(iModifier){
11return parseInt(Math.random()*iModifier);
12}
13function fnSetValues(){
14var iHeight=oForm.oHeight.options[
15oForm.oHeight.selectedIndex].text;
16if(iHeight.indexOf("Random")>-1){
17iHeight=fnRandom(document.body.clientHeight);
18}
19var sFeatures="dialogHeight: " + iHeight + "px;";
20return sFeatures;
21}
22function fnOpen(){
23var sFeatures=fnSetValues();
24window.showModalDialog("showModalDialog_target.htm", "",
25sFeatures)
26}
27</SCRIPT>
28<FORM NAME=oForm>
29窗口高度: <SELECT NAME="oHeight">
30<OPTION>-- 随机 --
31<OPTION>150
32<OPTION>200
33<OPTION>250
34<OPTION>300
35</SELECT>
36打开窗口:
37<INPUT TYPE="button" VALUE="打开窗口"
38onclick="fnOpen()">
39</FORM>
40</body>
41
42</html>