注册 登录
编程论坛 JavaScript论坛

帮忙修改个js 代码 谢谢

bodyguard 发布于 2009-09-01 23:11, 560 次点击
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效代码|始终在最前面的弹出窗口对话框</title>
</head>
<body>
<SCRIPT>
function fnRandom(iModifier){
return parseInt(Math.random()*iModifier);
}
function fnSetValues(){
var iHeight=oForm.oHeight.options[
oForm.oHeight.selectedIndex].text;
if(iHeight.indexOf("Radom")>-1){
iHeight=fnRandom(document.body.clientHeight);
}
var sFeatures="dialogHeight: " + iHeight + "px;";
return sFeatures;
}
function fnOpen(){
var sFeatures=fnSetValues();
window.showModalDialog("showModalDialog_target.htm", "",
sFeatures)
}
</SCRIPT>
<FORM NAME=oForm>
窗口高度: <SELECT NAME="oHeight">
<OPTION>-- 随机 --
<OPTION>150
<OPTION>200
<OPTION>250
<OPTION>300
</SELECT>
打开窗口:
<INPUT TYPE="button" VALUE="打开窗口"
onclick="fnOpen()">
</FORM>
</body>
</html>

能不能帮忙把这段代码修改成不要列表框    就只要点击那个按钮  就可以打开那个窗口

也就是把列表框中的数值直接写到上面的js 中去显示的效果是 就一个按钮  然后 点击弹出窗口
1 回复
#2
zongshi1232009-09-20 13:36
随机窗口高度是不?

程序代码:
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
<title>网页特效代码|始终在最前面的弹出窗口对话框</title>  
</head>  
<body>  
<SCRIPT>  
function fnRandom(iModifier){  
return parseInt(Math.random()*iModifier);  
}  
function fnSetValues(){  
var iHeight=fnRandom(document.body.clientHeight);  
var sFeatures="dialogHeight: " + iHeight + "px;";  
return sFeatures;  
}  
function fnOpen(){  
var sFeatures=fnSetValues();  
window.showModalDialog("showModalDialog_target.htm", "",  
sFeatures)  
}  
</SCRIPT>  
<FORM NAME=oForm>  
随机窗口高度:  
<INPUT TYPE="button" VALUE="打开窗口" onclick="fnOpen()">  
</FORM>  
</body>  
</html>
1