当前位置:网站首页>在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使用。
内部项目,不再贴图。
边栏推荐
- Listen to textarea input through Keyup to change button style
- Prompt during packaging: property 'sqlsessionfactory' or 'sqlsessiontemplate'‘
- Dump (cl\alv\tree\base================================cp|set\items\for\column) when expanding node or clicking toolbar button
- 反思 - 完美主义
- Schnuka: visual positioning system manufacturer what is a visual positioning system
- Schnuka: 3D machine vision inspection system 3D vision inspection application industry
- 呕心沥血总结出来的MySQL常见错误以及解决方法(一)
- qtcreator设置字符集
- Vulnhub's dc7 target
- 1031 Hello World for U
猜你喜欢

Using cdockablepane to realize floating window in MFC

面试官:为什么数据库连接很消耗资源,资源都消耗在哪里?

Concurrent idempotent anti shake

Appium automation test foundation ADB common commands (III)

Some examples.
![[old horse of industrial control] detailed explanation of Siemens PLC s7-300scl programming](/img/da/08f23cfe7f8759b73576eb0638fec5.png)
[old horse of industrial control] detailed explanation of Siemens PLC s7-300scl programming

电检码配置

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

SQL injection bypass (6)

【工控老马】PLC六路抢答器系统设计详解
随机推荐
时间操作 - 时间格式转换
【域渗透提权】CVE-2020-1472 NetLogon 权限提升漏洞
pycharm的虚拟环境如何共享到jupyter-lab
Alicloud access resource: nosuchkey
Check whether tensorflow supports GPU and test program
Little white battle pointer (Part 1)
Handle series - install spotbugs and use them quickly
[量化投资系统]Django从数据库中实现筛选及分页
Appium environment setup
基础知识 - 语法标准(ANSI C、ISO C、GNU C)
Interviewer: why does database connection consume resources? Where are the resources consumed?
软重启(reboot)
1031 Hello World for U
Kingbasees v8r6 cluster maintenance case -- single instance data migration to cluster case
Wechat applet learning notes (summer vacation)
Schnuka: what is visual positioning system? How visual positioning system works
jsp学习部分
358. K 距离间隔重排字符串 排序
The table cannot be vacuumed because the cursor is open for a long time
C # import CSV into MySQL database