最近因为项目要求做了一个layer弹出层demo,先看效果图

好了,现在开始上代码

index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head> <body>
<input type="button" onclick="openFirstLayer()" value="点击"/> <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript">
function openFirstLayer(){
/* layer.open({
type: 2,
title: ['你好','background-color:red,padding-left:5px'],
closeBtn: 1, //显示关闭按钮
shade: [0.3],
area: ['500px', '400px'],
offset: 'r', //右下角弹出,
move: false,
//anim: 4,
content: ['test.jsp', 'no'] //iframe的url,no代表不显示滚动条
}); */
layer.open({
type: 2,
title: ['历史进度展示','background-color:rgb(40, 144, 241);padding-left:5px;color:#fff'],
closeBtn: 1, //显示关闭按钮
shade: [0.3],
area: ['50%', '60%'],
offset: 'r', //右下角弹出,
move: false,
//anim: 4,
content: ['test.jsp', 'no'] //iframe的url,no代表不显示滚动条
});
}
</script>
</body>
</html>

test.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'test.jsp' starting page</title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head> <body>
<input type="button" onclick="openSecondLayer()" value="测试"/> <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript">
function openSecondLayer(){
/* parent.layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['420px', '240px'], //宽高
content: 'html内容',
cancel: function(index){
if(confirm('确定要关闭么')){ }
//return false;
}
}); */
parent.layer.open({
type: 2,
title: ['历史进度详情','background-color:rgb(40, 144, 241);padding-left:5px;color:#fff'],
//skin: 'layui-layer-rim', //加上边框
area: ['60%', '80%'], //宽高
content: ['test2.jsp','no'], //iframe的url,no代表不显示滚动条
cancel: function(index){
window.location.href = "test.jsp";
/* if(confirm('确定要关闭么')){ } */
//return false;
}
});
}
</script>
</body>
</html>

test2.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'test2.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
This is my JSP page. <br>
</body>
</html>

  只是一个简单demo展示,剩下的拓展需要自己再去深入挖掘

layer弹出层的更多相关文章

  1. layer弹出层不居中解决方案

    layer弹出层不居中解决方案 代码头中加入以下代码即可 <!doctype html>

  2. layer弹出层不居中解决方案,layer提示不屏幕居中解决方法,layer弹窗不居中解决方案

    layer弹出层不居中解决方案,layer提示不屏幕居中解决方法,layer弹窗不居中解决方案 >>>>>>>>>>>>> ...

  3. Layer弹出层销毁问题

    Layer弹出层销毁问题 最近开发时有个问题记录一下 点击按钮显示相应的图表信息,当时自己点感觉没问题,谁知到测试手里多次点击就会有后续打开的窗口无法渲染问题,看了半天才发现是调用layer.clos ...

  4. layer 弹出层 回调函数调用 弹出层页面 函数

    1.项目中用到layer 弹出层,定义一个公用的窗口,问题来了窗口弹出来了,如何保存页面上的数据呢?疯狂百度之后,有了结果,赶紧记下. 2.自己定义的公共页面方法: layuiWindow: func ...

  5. layer 弹出层 不居中

    layer弹出层不居中解决方案 代码头中加入以下代码即可 <!doctype html>

  6. layer弹出层设置相对父级元素定位

    layer弹出层默认是相对body固定定位的,可是项目中一般需要相对某个盒子相对定位,下面是个加载弹层例子: var loadIndex = layer.open({ type: 3, //3 表示加 ...

  7. 在子页面使用layer弹出层时只显示遮罩层,不显示弹出框问题

    最近子页面使用layer弹出层时只显示遮罩层,不显示弹出框,这个问题搞了很久,最后才发现,在子页面上使用弹出框时,如果只使用layer.alert()或者layer.open()时,会默认在当前页面弹 ...

  8. 常用的layer弹出层

    本文来自 松耦合 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/dunegao/article/details/78978448?utm_source=copy 常用 ...

  9. layer弹出层右上角的关闭按钮怎么没有显示

    问题描述:layer弹出层右上角的关闭按钮怎么没有显示,但鼠标移上去又可以点击 解决方式: 这是因为样式中需要一个图标,你的项目中缺少.解决如下:1.下载图标:http://www-x-zi-han- ...

随机推荐

  1. onSaveInstanceState()和onRestoreInstanceState()方法

    Activity的 onSaveInstanceState() 和 onRestoreInstanceState()并不是生命周期方法,它们不同于 onCreate().onPause()等生命周期方 ...

  2. ubuntu 操作系统相关操作

    查看操作系统位数 命令:  getconf LONG_BIT root@hbg:/# getconf LONG_BIT 64 查看操作系统信息 命令: lsb_release -a root@hbg: ...

  3. MySQL聚簇索引

    聚簇索引并不是一种单独的索引类型,而是一种数据存储方式.具体的细节依赖于其实现方式,但innoddb 的聚簇索引实际上在同一个结构中保存了B-Tree索引和数据行. 当表有聚簇索引时,它的数据实际上存 ...

  4. HDU 2064 汉诺塔III(递归)

    题目链接 Problem Description 约19世纪末,在欧州的商店中出售一种智力玩具,在一块铜板上有三根杆,最左边的杆上自上而下.由小到大顺序串着由64个圆盘构成的塔.目的是将最左边杆上的盘 ...

  5. Table获取checkbox选中行数据

    //检测勾选值 function checkEnter() { var Ivalue = ""; $("#dataTable tr").each(functio ...

  6. UILabel 的属性设置

    .设置字体样式(加粗) label.font = [UIFont boldSystemFontOfSize:30]; 6.设置字体类型 label.font = [UIFont fontWithNam ...

  7. tomcat session失效时间

    conf\web.xml <session-config> <session-timeout>600</session-timeout> </session- ...

  8. Python字符串连接方式

    python中有很多字符串连接方式,总结一下: 1 最原始的字符串连接方式:str1 + str22 python 新字符串连接语法:str1, str23 奇怪的字符串方式:str1 str24 % ...

  9. Minigui3.0 自定义遥控输入引擎

    本人最近在从事minigui的开发工作,使用的gui版本为最新的3.0.12,平台环境为海思的HI3515. 在历经千辛万苦,终于将gui成功的移植到了开发板上,这里不多赘述,没有移植成功的朋友可以点 ...

  10. VMware 8安装苹果操作系统Mac OS X 10.7 Lion正式版

    今天介绍下VM8下安装Mac OS X 10.7  1.工具篇       下载Vmware Workstation 8.0正式版http://115.com/file/bhyk1l2u#       ...