当前位置:网站首页>在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使用。
内部项目,不再贴图。
边栏推荐
- C actual combat - high configuration version of Snake game design
- C实战——高配版贪吃蛇游戏设计
- About the problem that the kingbasees temporary file is too large
- 时间操作 - 时间格式转换
- js:Array.reduce累加计算、合并数组
- Perceiving healthy life, enabling boundless connection -- contributing to openharmony 3.1 ecological construction
- [industrial control old horse] detailed explanation of design principle of pattern fountain based on PLC
- jsp学习部分
- ROS2中的行为树 BehaviorTree
- cv2.cvtColor
猜你喜欢

Interviewer: why does database connection consume resources? Where are the resources consumed?

Listen to textarea input through Keyup to change button style

cv2.cvtColor

Appium automation test foundation ADB common commands (II)

呕心沥血总结出来的MySQL常见错误以及解决方法(二)

Handle series - install spotbugs and use them quickly

VSLAM特征之线特征&面特征

Simulation analysis of sailing dynamics

ROS2中的行为树 BehaviorTree

电检码配置
随机推荐
[industrial control old horse] detailed design of PLC six way responder system
【深度之眼吴恩达机器学习作业班第四期】Regularization正则化总结
面试官:为什么数据库连接很消耗资源,资源都消耗在哪里?
Schnuka: 3D visual recognition system 3D visual inspection principle
呕心沥血总结出来的MySQL常见错误以及解决方法(二)
Compiling principle: the king's way
[FreeRTOS] interrupt mechanism
指针引用数组元素
498. diagonal traversal (simulation)
Codeforces Round #799 (Div. 4)
Oracle batch insert data - insert ethnic data
100 lectures on Excel advanced drawing skills (VI) - practical application cases of Gantt chart in project progress
C#Mqtt订阅消息
Detailed explanation of route (Jiuyang Scripture)
ShapeShifter: Robust Physical Adversarial Attack on Faster R-CNN Object Detector
Common MySQL errors and solutions summarized painstakingly (II)
Vulnhub's DC8 target
C编译器 - 隐式函数声明
Vulnhub's dc7 target
719. find the distance of the number pair with the smallest K (two points)