Welcome 微信登录

首页 / 网页编程 / ASP.NET / Thickbox的使用

Thickbox的使用2011-08-01 博客园 水丰寸1、父页面添加引用

<link href="thickbox.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script src="thickbox.js" type="text/javascript"></script>

2、父页面添加如下链接地址:

<a href="Tree3Status/ParamSel.aspx? keepThis=true&TB_iframe=true&height=450&width=770" title="选择科目" class="thickbox" </a>

也可以在上面拼接参数

修改:

thickbox 弹出层的遮住层透明度修改

.TB_overlayBG {
background-color:#000;
filter:alpha(opacity=75);
-moz-opacity: 0.75;
opacity: 0.75;
}

关闭层:

onclick="self.parent.tb_remove();"

关闭层刷新父页面:

修改:thickbox.js

添加如下函数:

// 刷新打开本窗口的opener窗口.
function refreshOpener(){
// 可能存在frame页面,所以要引用top窗口

var win = top.window;
try
{
// 刷新.
if(win)
{
win.location.reload();
}
}
catch(ex)
{
// 防止opener被关闭时代码异常。
}
}

// 刷新opener窗口后关闭自己。
function refreshOpenerAndCloseMe(){
tb_remove();
refreshOpener();

然后修改$("#TB_closeWindowButton").click(tb_remove);为

$("#TB_closeWindowButton").click(refreshOpenerAndCloseMe);