风之石 请 如何有一个像样弹出层啊!!!!!

plglenn28 2009-12-17 09:14:01
如何有一个弹出层啊!!!!!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>



<script src="easyMask.js" type="text/javascript"></script>

<script src="easyUI.js" type="text/javascript"></script>
<script src="easyLayer.js" type="text/javascript"></script>


</head>
<body>

<INPUT onclick=a() type=button>
<div id="ldiv" style ="background-color:#ff0;width:50px;height:50px;color:Blue; " >dfdf</div>


</body>
</html>
<script>
//遮罩DEMO
function a() {

// var dx =121, dxs = 21;
// var nx = new easyDragDrop(dx, dx, [184, 525, 584, 25], false);


var abc = document.getElementById("ldiv");
var layer = easyLayer(abc , 2, 500, 250);
var em = new easyMask(layer, 1000, 1000, 1, "#000", 60, false );
em.open();
}


</script>


...全文
104 6 打赏 收藏 举报
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
dh20156 2009-12-17
  • 打赏
  • 举报
回复
不好意思,刚看到你这个帖子。请参考:


<html>
<head>
<title>show popup layer</title>
<style type="text/css">
html,body{height:100%;overflow:hidden;}
</style>
</head>
<body>
<button onclick="showpopup('title here','content here ^_^');">show popup layer</button>
</body>
<script type="text/javascript" src="http://www.easyui.org.cn/easyui.js"></script>
<!--如果不需要拖拽,则不需要加载easydragdrop.js-->
<script type="text/javascript" src="http://www.easyui.org.cn/easydragdrop.js"></script>
<script type="text/javascript" src="http://www.easyui.org.cn/easylayer.js"></script>
<script type="text/javascript" src="http://www.easyui.org.cn/easymask.js"></script>
<script type="text/javascript" src="http://www.easyui.org.cn/easypopup.js"></script>
<script type="text/javascript">
var dmask = new easyMask(null,'100%','100%',100,'#000',30,false);
var dpopup = new easyPopup(null,'formsubmitpopup',null,'#0055EA','#fff',true,500,250,10010);
var showpopup = function(stitle,scontent,fooclick,fooclose){
//easypopup属性及事件请参阅http://www.easyui.org.cn/easydraglayer.html
dpopup.fixsize = true;
dpopup.autofullsize = false;
dpopup.setShadow();
if(fooclick&&fooclick.constructor==Function){dpopup.onclick = function(e){var d = easyUI.getTarget(e);fooclick(d,dpopup);};}
dpopup.onopen = function(){dmask.open();};
dpopup.onclose = function(){dmask.close();if(fooclose&&fooclose.constructor==Function){fooclose();}};
dpopup.setTitle(stitle);
dpopup.setContent(scontent);
if(!dpopup.isopen){dpopup.open();}
};
</script>
</html>
真哥哥 2009-12-17
  • 打赏
  • 举报
回复
用jQuery做:
function lo(){
$("#work").load(url,type);
}
URL是你要弹出层的页面地址
work是自己创建的div id
type是你往弹出层传数据,不要也行
例:
document.writeln("<div id='work' style='z-index:9999;display:none; width:1000px;

height:249px; border: 0px solid red;position:absolute;top:expression

((document.documentElement.clientHeight-this.offsetHeight)/3);left:expression

((document.documentElement.clientWidth-this.offsetWidth)/2);'></div>");

onclick="lo('husbandry_chicken.jsp',{'index':1,'img':'Chicken_3.png');
zizihaier 2009-12-17
  • 打赏
  • 举报
回复
直接复制就可看到效果

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>LIGHTBOX EXAMPLE</title>
<style>
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 25%;
height: 25%;
padding: 16px;
border: 16px solid orange;
background-color: white;
z-index:1002;
overflow: auto;
}
</style>

<script type="text/javascript">

function showDiv()
{
document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';
}

function getResult()
{
document.getElementById('light').style.display='none';
document.getElementById('fade').style.display='none';
document.getElementById('text1').value=document.getElementById('txt1').value;
}
</script>
</head>
<body>
<br>
<br>
<input type="text" value="" id="text1">
<p>
<a href = "javascript:void(0)" onclick = "showDiv();">点击这里打开窗口</a>
</p>
<br>
<br>

<div id="light" class="white_content">


<table>
<tr>
<td align="right">输入名称</td>
<td width="78%"> <input id="txt1" type="text" /></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="添加" onclick=""/>
<input type="reset" value="重置" /></td>
</tr>
</table>


<a href = "javascript:void(0)" style="position:absolute;top:0px;right:0px;" onclick = "getResult()">Close</a>
</div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
sunxing007 2009-12-17
  • 打赏
  • 举报
回复
楼主的头像莫非是村上里沙? @^@
kathy_love150 2009-12-17
  • 打赏
  • 举报
回复
说明白点 具体想实现怎样个功能啊
cntmi 2009-12-17
  • 打赏
  • 举报
回复
[code=HTML
<html>
<head>
<title>2008年命运</title>
<meta http-equiv="Content-Language" content="gb2312" />
</head>
<body oncontextmenu="return false">
<div style="z-index: 100; left: 315px; width: 25%; position: absolute; top: 200px">
<input type="button" value="2008年命运" onclick="sAlert('这是内容');" />
</div>
<script type="text/javascript" language="javascript">
function sAlert(str){
var msgw,msgh,bordercolor;
msgw=400;//提示窗口的宽度
msgh=200;//提示窗口的高度
titleheight=25 //提示窗口标题高度
bordercolor="#ffcccc";//提示窗口的边框颜色
titlecolor="#0909F7";//提示窗口的标题颜色
var sWidth,sHeight;
sWidth=document.body.offsetWidth;
sHeight=screen.height;
//创建一个大的DIV---bgDiv 作为背景遮阴
var bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#777";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.6";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
//在bgDiv里面创建一个用于显示消息的msgDiv
var msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");
msgObj.setAttribute("align","center");
msgObj.style.background="#EEC591";
msgObj.style.border="1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "50%";
msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px" ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgObj.style.width = msgw + "px";
msgObj.style.height =msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight ="25px";
msgObj.style.border = "4px #ff0000 double";
msgObj.style.zIndex = "10001";
//用于显示消息头信息的
var title=document.createElement("h1");
title.setAttribute("id","msgTitle");
title.setAttribute("align","right");
title.style.margin="0";
title.style.padding="3px";
title.style.background="#FF4040";
title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
title.style.opacity="0.75";
title.style.border="1px solid " + bordercolor;
title.style.height="18px";
title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
title.style.color="#17081A";
title.style.cursor="pointer";
title.innerHTML="点击=关闭";
title.onclick=function(){
document.body.removeChild(bgObj);
document.getElementById("msgDiv").removeChild(title);
document.body.removeChild(msgObj);
}


document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(title);
var txt=document.createElement("p");
txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
txt.innerHTML=str;
document.getElementById("msgDiv").appendChild(txt);
}
</script>
</body>
</html>
[/code]
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2009-12-17 09:14
社区公告
暂无公告