编程论坛
注册
登录
编程论坛
→
JavaScript论坛
ShowModalDialog函数打开一个子窗口能不能将关闭按钮设置为不可见
jhunix008
发布于 2010-03-18 14:28, 2267 次点击
希望跳出的子窗口不显示关闭按钮这一栏。请问如何实现?
10 回复
#2
jhunix008
2010-03-18 14:53
或者还有别的方法可以实现?
#3
foktime
2010-03-18 14:57
不能设置。
自己用层做个吧
#4
jhunix008
2010-03-18 15:14
请版主介绍下如何用层来实现?
谢谢!
#5
foktime
2010-03-18 15:19
就是div。
刚看网上到处转贴这段代码 ,行不行我没试。不想自己写的话放上这段测试一下吧
程序代码:
//
我99的兼容IE,FF ,Opera
var
win=
new
MdiWindow(
/*
width
*/
300 ,
/*
height
*/
200 ,
/*
left
*/
1 ,
/*
top
*/
100,
/*
下方不可操作
*/
true
);
win.setSize(300,200);
//
设置大小
win.setWindowArguments({window:window});
//
或win.setWindowArguments(window)
win.load("login.html");
win.frame.location.reload();
//
刷新
win.onClose=
function
(){
//
闭时回调函数
}
win.close();
//
关闭
//
子窗口代码:
parent.initWindowArguments(window);
window.close();
//
关闭自己
var
opener=windowArguments.window;
opener.reload();
//
刷新父页面
windowHandler.btnClose.hide();
//
隐藏关闭按钮。
[
本帖最后由 foktime 于 2010-3-18 15:20 编辑
]
#6
jhunix008
2010-03-18 15:30
谢谢!我试试。
#7
jhunix008
2010-03-18 16:49
我的系统无法使用MdiWindow,也没有flex组件。不知还有方法吗?
#8
foktime
2010-03-19 08:12
用div做
其实我很懒,但我发现你比我还懒,我懒的写代码,你懒的去搜别人写好的代码
网上用层模拟窗口的例子实在太多了,犯不着自己写,所以我替你搜了一段demo,可以随滚动条滚动的, 用的时候自己加加样式就ok了
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. lang="zh-CN">
<head>
<title></title>
<script>
function
getPosition() {
var
top = document.documentElement.scrollTop;
var
left = document.documentElement.scrollLeft;
var
height = document.documentElement.clientHeight;
var
width = document.documentElement.clientWidth;
return
{top:top,left:left,height:height,width:width};
}
function
showPop(){
var
width = 300;
//
弹出框的宽度
var
height = 160;
//
弹出框的高度
var
obj = document.getElementById("pop");
obj.style.display = "block";
obj.style.position = "absolute";
obj.style.zindex = "999";
obj.style.width = width + "px";
obj.style.height = height + "px";
var
Position = getPosition();
leftadd = (Position.width-width)/2;
topadd = (Position.height-height)/2;
obj.style.top = (Position.top + topadd) + "px";
obj.style.left = (Position.left + leftadd) + "px";
window.onscroll =
function
(){
var
Position = getPosition();
obj.style.top = (Position.top + topadd) +"px";
obj.style.left = (Position.left + leftadd) +"px";
};
}
function
hidePop(){
document.getElementById("pop").style.display = "none";
}
</script>
</head>
<body>
<div id="pop" style="border:1px solid #CCC;display:none;">test<br /><a href="javascript:hidePop();">hide</a></div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a href="javascript:showPop()">show</a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
hide隐藏窗口 相当于关闭按钮,不要就去掉
#9
zhuyunshen
2010-03-19 08:46
不会
#10
jhunix008
2010-03-19 08:56
谢谢!
#11
cuinan128
2010-04-01 13:45
第一次路過進來看看 有沒有什麽可以學習的
路過進來看看 想學習學習 希望大家可以幫助我
大家說的太好了 我也要好好學習一下 大家請多指教
1