(人笨,占时想法的办法,不要骂,不要骂,怕了怕了,想到别的会来改的)

父页面;

<%@ page language="java" contentType="text/html; charset=utf-8" 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><!-- keep on record 备案 --></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">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" href="<%=basePath %>base/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="<%=basePath %>base/layuiadmin/style/admin.css" media="all"> </head>
<body>
<div class="layui-fluid"><!-- 布局容器 -->
<div class="layui-row layui-col-space15"> <!-- 列间距 -->
<div class="layui-col-md12"><!-- 列元素 -->
<div class="layui-card"><!-- 卡片面板 -->
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form" action="" lay-filter="keep-on-record"> <div class="layui-collapse">
<div class="layui-colla-item">
<h2 class="layui-colla-title">提交资料自检</h2>
<div class="layui-colla-content layui-show">
<iframe name="receiving" lay-filter="receiving" id="receiving" src="projects/Post_certificate/Head.jsp?id=<%=id %>" style="width: 100%; height: 86%;"></iframe>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" id="save">保存</button>
<button type="reset" class="layui-btn layui-btn-primary" id='close'>关闭</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div> <script src="<%=basePath %>base/layuiadmin/layui/layui.js"></script>
</body>
<script>
// 当你使用表单时,layui 会对 select、checkbox、radio 等原始元素隐藏,从而进行美化修饰处理。但这需要依赖于 form 组件,所以你必须加载 form,并且执行一个实例
layui.use(['form','laydate','element'], function(){
var $ = layui.$;
var form = layui.form //只有执行了这一步,部分表单元素才会自动修饰成功
,element = layui.element
,laydate = layui.laydate
,layer = layui.layer
,layero = layui.layero; $('#save').click(function(){
console.log("----");
var childWindow = $("#receiving")[0].contentWindow;
//childWindow.bridging();
/* 调用 Head.jsp 下的 bridging (),
此方法是外部方法,还需在 Head.jsp 下编写方法 调用 layui.use() 内的方法 ,
因为 需要获得 Head.jsp 内的表单数据,
也可以在 Head.jsp 外部的方法获得表单 数据*/

  //修改2021.02.24 // 直接调用全局方法
   childWindow.cs();
}); });
</script>
</html>

子页面:

<%@ page language="java" contentType="text/html; charset=utf-8" 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><!-- --></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">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link rel="stylesheet" href="<%=basePath %>base/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="<%=basePath %>base/layuiadmin/style/admin.css" media="all"> </head>
<body>
<form class="layui-form" action="" lay-filter="header-information">
<!-- 吧啦吧啦 的 表单内容 -->
</form>
<script src="<%=basePath %>base/layuiadmin/layui/layui.js"></script>
</body>
<script>
// 当你使用表单时,layui 会对 select、checkbox、radio 等原始元素隐藏,从而进行美化修饰处理。但这需要依赖于 form 组件,所以你必须加载 form,并且执行一个实例
layui.use(['form','element'], function(){
var $ = layui.$;
var form = layui.form //只有执行了这一步,部分表单元素才会自动修饰成功
,element = layui.element; window.head2 = function () { // 写一个全局方法
console.log("进入内部");
};

window.cs=function(){
  console.log("进入内部");
}

function head(){
//获取表单区域所有值
var data = form.val("header-information");
console.log(data);
} });
function bridging(){
//console.log("--------------");
head2(); // 调用全局方法
} </script>
</html>

layui 如果调用 from 内嵌入的 iframe子页面方法的更多相关文章

  1. layui type:2 iframe子页面向父页面传值

    需求: 选择子页面表格中的radio或者双击该行,得到的该行数据传到父页面,由父页面渲染. 网上的各种方法都用了,父页面就是获取不到子页面传的值,过了一晚上,睡了一觉,柳暗花明又一村. layui t ...

  2. 父窗口调用iframe子窗口方法

    一.父窗口调用iframe子窗口方法 1.HTML语法:<iframe name="myFrame" src="child.html"></i ...

  3. iframe子页面调用父页面javascript函数的方法

    1.iframe子页面调用 父页面js函数 子页面调用父页面函数只需要写上window.parent就可以了.比如调用a()函数,就写成: window.parent.a(); 2.iframe父页面 ...

  4. js之iframe子页面与父页面通信

    iframe子页面与父页面通信根据iframe中src属性是同域链接还是跨域链接,通信方式也不同. 一.同域下父子页面的通信 父页面parent.html <html> <head& ...

  5. jquery读取iframe子页面和父页面的处理

    1. jquery 在iframe子页面获取父页面元素代码如下: $("#objid", parent.document) 2. jquery在父页面 获取iframe子页面的元素 ...

  6. js 在iframe子页面获取父页面元素,或在父页面 获取iframe子页面的元素的几种方式

    用JS或jquery访问页面内的iframe,兼容IE/FF 注意:框架内的页面是不能跨域的! 假设有两个页面,在相同域下. index.html 文件内含有一个iframe: XML/HTML代码 ...

  7. iframe子页面与父页面元素的访问以及js变量的访问

    1.子页面访问父页面元素  parent.document.getElementById('id')和document相关的方法都可以这样用 2.父页面访问子页面元素  document.getEle ...

  8. JS中iframe子页面与父页面之间通信

    iframe子页面与父页面通信根据iframe中src属性是同域链接还是跨域链接,通信方式也不同. 一.同域下父子页面的通信 父页面parent.html <html> <head& ...

  9. iframe子页面与父页面通信

    同域下父子页面的通信 父页面: <!DOCTYPE html> <html> <head lang="en"> <meta charset ...

随机推荐

  1. 使用VUE+原生PHP完成搜索后分页的效果

    html代码: <!doctype html> <html lang="en"> <head> <meta charset="U ...

  2. netty 处理客户端连接

    Netty如何处理连接事件 上文讲了Netty如何绑定端口,现在我们来阅读下netty如何处理connect事件.上文我们说了NioEventLoop启动后不断去调用select的事件,当客户端连接时 ...

  3. 从0到1使用Kubernetes系列(二):安装工具介绍

    该系列第一篇为:<从0到1使用Kubernetes系列--Kubernetes入门>.本文是Kubernetes系列的第二篇,将介绍使用Kubeadm+Ansible搭建Kubernete ...

  4. 力扣 - 剑指 Offer 53 - I. 在排序数组中查找数字 I

    题目 剑指 Offer 53 - I. 在排序数组中查找数字 I 思路1 一般来说,首先想到的是使用一个变量,从头开始遍历整个数组,记录target数组出现的次数,但是这样的时间复杂度是O(n),还是 ...

  5. 第3次 Beta Scrum Meeting

    本次会议为Beta阶段第3次Scrum Meeting会议 会议概要 会议时间:2021年6月2日 会议地点:「腾讯会议」线上进行 会议时长:0.5小时 会议内容简介:对完成工作进行阶段性汇报:对下一 ...

  6. 【技术博客】利用handler实现线程之间的消息传递

    [技术博客]利用handler实现线程之间的消息传递 一.handler简介 在Android Studio的开发中,经常需要启动多个线程.比如向远程发送请求时,必须新开一个子线程,否则会造成程序崩溃 ...

  7. OO第三单元

    OO第三单元 JML语言理论基础,应用工具链 JML语言基础 JML简介 定义: JML 是一种形式化的. 面向 JAVA 的行为接口规格语言 作用: 开展规格化设计.这样交给代码实现人员的将不是可能 ...

  8. Spring Cloud Alibaba Nacos Config 的使用

    Spring Cloud Alibaba Nacos Config 的使用 一.需求 二.实现功能 1.加载 product-provider-dev.yaml 配置文件 2.实现配置的自动刷新 3. ...

  9. noip模拟11

    T1 math 就挺水一小破题目,第一眼看好像不可做,看着看着突然发现假设x和y的最大公约数是gcd,那么kx%y一定是gcd的倍数, 然后想到可以把所有数字与k的gcd求出来,打一个完全背包,可是仔 ...

  10. webshell绕过D盾

    PHP常见的代码执行函数: eval() assert() preg_replace() create_function() array_map() call_user_func() call_use ...