Js Jquery创建一个弹出层可加载一个页面
2018-10-12 13:52
691 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> New Document </title>
<script type="text/javascript" src="../jquery-1.7.2.js"></script>
<script type="text/javascript">
//创建一个弹出层,title 标题,width 宽度,height 高度,content 内容,url 如果url不为空时则覆盖content加载url页面中的内容
function CreatePopLayerDiv(title,width,height,content,url){
var titles = title || "标题";
var Iheight=$(window).height();
var Iwidth =$(window).width();
var heights = height || 300;
var widths = width || 500;
var Oheight= (Iheight -heights) / 2;
var Owidth = (Iwidth - widths) /2;
var contents = content || "内容";
var div = "<div id='InDiv' style='width:"+Iwidth+"px;height:"+Iheight+"px;background-color:#888;position:absolute;z-index:10000;top:0;left:0;opacity:0.7;'><div id='offDiv' style='width:"+widths+"px;height:"+heights+"px;left:"+Owidth+"px;top:"+Oheight+"px;background-color:white;position:absolute;z-index:10001;'><h4 id='HTitle' style='margin:0px;padding:3px;background:#336699;opacity:0.9;border:1px solid ##336699;height:20px;line-height:20px;font:12px Verdana, Geneva, Arial, Helvetica, sans-serif;color:white;cursor:pointer;text-align:left;'>"+titles+"<a id='AClose' onclick='btnCloses()' style='float:right;'>关闭</a></h4><div id='Content'>"+contents+"</div></div></div>";
$(document.body).append(div);
if(url != ""){
$("#Content").load(url);
}
}
//移除弹出层
function RemoveDiv(){
$("#AClose").remove();
$("#HTitle").remove();
$("#offDiv").remove();
$("#InDiv").remove();
}
$(function(){
$("#btnTCC").click(function(){
CreatePopLayerDiv("闪耀的瞬间",600,400,"弹出层","table偶数行变色.html");
});
})
function btnCloses(){
RemoveDiv();
}
</script>
</head>
<body>
<input type="button" id="btnTCC" value="弹出层" />
</body>
</html>
您可能感兴趣的文章:
相关文章推荐
- Js Jquery创建一个弹出层可加载一个页面
- Js Jquery创建一个弹出层(当加载一个页面进弹出层时出现乱码)
- Ajax加载外部页面的一个弹出层效果
- 在页面加载page_load时,弹出一个js对话框:欢迎光临!
- Ajax加载外部页面的一个弹出层效果
- 点击新增按钮,弹出对话框,并且对话框加载另外一个页面的内容的具体实现
- 使用Jquery向一个空白网页动态创建一个iframe,及嵌入页面,和向嵌入页面传参
- Jquery,css如何创建一个悬浮的广告页面?
- Ajax加载外部页面弹出层效果实现方法
- 一个页面从输入 URL 到页面加载完的过程中都发生了什么事情?
- 如何创建一个CSS3 Ajax加载图标没有图像
- 微信小程序:如何创建一个小程序页面?
- 如何创建一个用弹出窗口来查看详细信息的超链接列
- ajax+jQuery实现一个页面同时加载多个模块!
- 一个简单的加载模块弹出ProgressBar 加载进度条
- 关于《创建组件**失败。错误消息为**未能加载文件或程序集**或它的某一个依赖。系统找不到指定文件。》的解决方案
- 为Go Web App 创建一个主页面
- 一个页面从输入URL到页面加载显示完成,这个过程都发生什么?
- Node创建服务并加载静态页面
- 确认框的使用。弹出一个确认框,Ajax提交一个请求,刷新页面。