当前位置:网站首页>iframe简单使用 、获取iframe 、获取iframe 元素值 、iframe获取父页面的信息
iframe简单使用 、获取iframe 、获取iframe 元素值 、iframe获取父页面的信息
2022-06-25 07:01:00 【追求~】
1.iframe简单使用
<iframe> 标签规定一个内联框架。
一个内联框架被用来在当前 HTML 文档中嵌入另一个文档。
<iframe width=420 height=330 frameborder=0 scrolling=auto src=URL></iframe>
- width插入页的宽;
- height插入页的高;
- scrolling 是否显示页面滚动条(可选的参数为auto、yes、no,如果省略这个参数,则默认为auto);
- frameborder 边框大小;
注意:URL建议用绝对路径
<iframe width=0 height=0 frameborder=0 scrolling=auto src=WWW .webjx.com></iframe>
如果一个页面里面有框架,点页面里的连接,要求在这个<iframe> 里打开。在<iframe >中规定name
<iframe name=** ></iframe>
然后在修改默认打开模式,:网页head中加上<a href=URL target=**>或部分连接的目标框架设为(**)
要插入一个页面。要求只拿中间一部分。其他的都不要。
代码:
<iframe name=123 align=middle marginwidth=0 marginheight=0 vspace=-170 hspace=0 src="http://www.webjx.com/" frameborder=no scrolling=no width=776 height=2500></iframe>
控制插入页被框架覆盖的深度 marginwidth=0 marginheight=0;控制框架覆盖上部分的深度 vspace=-170
scrolling滚动条要否(auto、yes、no) frameborder框架的边框大小,width=776 height=2500此框架的大小。
2.获取iframe
常用获取元素的方法,dom ,jQ等;
var ifr = document.getElementById(‘mainIframe0’)
3.获取iframe 元素值
ifr.contentWindow
拿到的是window 对象
Window {
postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, parent: Window,
…}
ifr.contentWindow.值 定义的全局变量。
4.iframe获取父页面的信息:
获取父页面元素的值:
jquery方式:$("#auditDate",parent.document).val();
js方式:parent.document.getElementById(“auditDate”).value;
边栏推荐
- 家庭服务器门户Easy-Gate
- Electronics: Lesson 008 - Experiment 6: very simple switches
- [supplementary question] 2021 Niuke summer multi school training camp 6-n
- Socket problem record
- Biweekly investment and financial report: capital ambush Web3 infrastructure
- Bluecmsv1.6- code audit
- Websocket understanding and application scenarios
- 2022年毕业生求职找工作青睐哪个行业?
- The first game of 2021 ICPC online game
- Want to open an account, is it safe to open an online stock account?
猜你喜欢

Scanpy (VII) spatial data analysis based on scanorama integrated scrna seq

417 sequence traversal of binary tree 1 (102. sequence traversal of binary tree, 107. level traversal of binary tree II, 199. right view of binary tree, 637. layer average of binary tree)

Matlab code format one click beautification artifact

每日刷题记录 (三)

PH neutralization process modeling

共话云原生数据库的未来

CVPR 2022 oral 2D images become realistic 3D objects in seconds

Bluecmsv1.6- code audit

TCP stuff

STM32CubeMX 學習(5)輸入捕獲實驗
随机推荐
4 raisons inconnues d'utiliser le "déplacement sûr à gauche"
How to create a new branch with SVN
图像超分综述:超长文一网打尽图像超分的前世今生 (附核心代码)
面试前准备好这些,Offer拿到手软,将军不打无准备的仗
Wechat applet introduction record
Unit conversion - mm to pixel - pixel to MM
每日刷题记录 (三)
Drawing of clock dial
[Mobius inversion]
TS environment setup
A solution to slow startup of Anaconda navigator
Websocket understanding and application scenarios
自制坡道,可是真的很香
rosbag
Debugging mipi-dsi screen based on stm32mp157
allgero报错:Program has encountered a problem and must exit. The design will be saved as a .SAV file
使用apt-get命令如何安装软件?
Authority design of SaaS system based on RBAC
函数尽量不要通过变量指定操作类型
FM signal, modulated signal and carrier