弹出窗口js

 1---------------------
<script language="javascript">
function donePost(str1,str2...)
{
把要打开的弹出窗口的参数传递给当前页面;
}

var isDisplay = false;
var isOpen = false;
var inputBox="";

function openDiv(object1)
{
//设置弹出窗口的url
url = "/bms/WEB-ROOT/bms/pub/selectUser.do?type=post&openerMethod=donePost&project_id="+document.all.projectId.value;
//以下的基本上不需要改动
text = '<iframe name="deeptree" style="width: 300;height: 250;" src="'+url+'" >不支持</iframe>';
forTest.innerHTML=text;

inputBox=object1;

var left = inputBox.getBoundingClientRect().left;
var top = inputBox.getBoundingClientRect().top;

left = inputBox.getBoundingClientRect().left + inputBox.clientWidth;
top = inputBox.getBoundingClientRect().top + inputBox.clientHeight;

document.all.forTest.style.left = left;
document.all.forTest.style.top = top;

closeDiv();

document.all.forTest.style.display = "";
isDisplay = true;
}

function closeDiv()
{
objUnknown = window.event.srcElement;
if(objUnknown==null)
return;
if(objUnknown.tagName == "INPUT" || objUnknown.tagName=="div")
{
if(objUnknown.name==inputBox.name||objUnknown.name=="deeptree")
{
return;
}
}

if(isDisplay)
{
document.all.forTest.style.display = "none";
isDisplay = false;
}
}
</Script>

2--------------------------
//<body 中加入以下东西 onclick="closeDiv();"> 表示单击<body>区域关闭弹出窗口
<body leftmargin="0" topmargin="0" onclick="closeDiv();">

3--------------------------
<form></form>中应该加入:
<div id="forTest" style="border:0px solid #EEEEEE ;position: absolute; display:none; z-index: 0; background-color:white;"></div>
4--------------------------

需要用到弹出窗口道的地方加入 onClick="openDiv(this);" :
如:<input type="button" name="selectBt" onClick="openDiv(this);" class="button_bg3" value='选 择' style="cursor:hand">
this表示当前form中的div[code="java"]
[/code]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值