当前位置:网站首页>在iframe标签中操作外层dom
在iframe标签中操作外层dom
2022-06-29 06:41:00 【六卿】
在iframe标签中操作外层dom
今天遇到了个问题,在此记录。
本身是同一个管理系统,分上下,下分左右;左侧就是菜单list,右侧就是内容区,在内容区的顶部有一个tab标签,来收集当前开启的页面,展示title,可以手动关闭。
具体内容区展示什么,使用的是iframe标签进行切换src实现的。
我这里其实问题很简单,就是在iframe中触发外层的事件,a标签控制click一下就可以。
这里使用了jq:
const changeAElement =(href,name)=>{
$("#transAElement", window.parent.document).attr('href', href).text(name)[0].click();
}
// 链路质量分析 详情跳转
$('.detailsBtnLeft1').on('click', () => {
let href = "/newPage.html";
let name = '质量分析'
changeAElement(href,name)
})
最外层dom:
<a id="transAElement" style="position: relative;left: -1000px;opacity: 0;" class="J_menuItem" href="">查询</a>
J_menuItem的dom会增加一个点击事件,再点击事件里面获取href属性,给iframe用作src使用。
内部项目,不再贴图。
边栏推荐
- ROS2中的行为树 BehaviorTree
- 关于开发web场景下如何解决手机访问web跨域问题
- 498. 对角线遍历(模拟)
- SAP ui5 Beginner (I) Introduction
- Cartographer中的线程池操作
- C编译器 - 隐式函数声明
- Handle series - install spotbugs and use them quickly
- [industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC
- 【深度之眼吴恩达机器学习作业班第四期】Linear Regression with One Variable,单变量线性回归
- 编程能力提升方向
猜你喜欢

Handle series - install spotbugs and use them quickly

Common MySQL errors and solutions summarized painstakingly (I)

C actual combat - high configuration version of Snake game design

tf. count_ nonzero

【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞

Protobuf 二进制文件学习及解析

【量化投资系统】因子处理安装talib

打包时提示: Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘

【修复收藏功能、更新登录接口】知识付费小程序、博客小程序、完整版开源源码、资源变现小程序,带299整站资源数据

从Nacos客户端谈Nacos配置中心
随机推荐
【量化投资系统】因子处理安装talib
How to permanently set Mysql to utf8 encoding?
电检码配置
498. diagonal traversal (simulation)
358. K 距离间隔重排字符串 排序
Oracle 批量插入数据-插入民族数据
How to share the virtual environment of pycharm to jupyter Lab
Loop nesting: why can large loops inside and small loops outside improve the running efficiency of programs
1031 Hello World for U
数组知识点小结
【工控老马】基于西门子S7-200PLC的跑马灯控制系统的设计方案详解
软重启(reboot)
关于开发web场景下如何解决手机访问web跨域问题
About the problem that the kingbasees temporary file is too large
Schnuka: 3D visual inspection scheme 3D visual inspection application industry
程序调试 - Debug/Release 版本
C编译器 - 隐式函数声明
Vulnhub's dc9 target
多态中的向上和向下转型
[industrial control old horse] detailed explanation of design principle of pattern fountain based on PLC