- 浏览: 545487 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (618)
- java (109)
- Java web (43)
- javascript (52)
- js (15)
- 闭包 (2)
- maven (8)
- 杂 (28)
- python (47)
- linux (51)
- git (18)
- (1)
- mysql (31)
- 管理 (1)
- redis (6)
- 操作系统 (12)
- 网络 (13)
- mongo (1)
- nginx (17)
- web (8)
- ffmpeg (1)
- python安装包 (0)
- php (49)
- imagemagic (1)
- eclipse (21)
- django (4)
- 学习 (1)
- 书籍 (1)
- uml (3)
- emacs (19)
- svn (2)
- netty (9)
- joomla (1)
- css (1)
- 推送 (2)
- android (6)
- memcached (2)
- docker、 (0)
- docker (7)
- go (1)
- resin (1)
- groovy (1)
- spring (1)
最新评论
-
chokee:
...
Spring3 MVC 深入研究 -
googleyufei:
很有用, 我现在打算学学Python. 这些资料的很及时.
python的几个实用网站(转的) -
hujingwei1001:
太好了找的就是它
easy explore -
xiangtui:
例子举得不错。。。学习了
java callback -
幻影桃花源:
太好了,謝謝
Spring3 MVC 深入研究
query取得iframe中元素的几种方法 在iframe子页面获取父页面元素 $(document.getElementById('iframeId').contentWindow.document.body).html()
代码如下:
$('#objId', parent.document);
// 搞定...
在父页面 获取iframe子页面的元素
代码如下:
$("#objid",document.frames('iframename').document)
显示iframe中body元素的内容。
$("#testId", document.frames("iframename").document).html();
根据iframename取得其中ID为"testId"元素
$(window.frames["iframeName"].document).find("#testId").html()
用JS或jQuery访问页面内的iframe,兼容IE/FF
注意:框架内的页面是不能跨域的!
假设有两个页面,在相同域下.
index.html 文件内含有一个iframe:
XML/HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>页面首页</title>
</head>
<body>
<iframe src="iframe.html" id="koyoz" height="0" width="0"></iframe>
</body>
</html>
iframe.html 内容:
XML/HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>iframe.html</title>
</head>
<body>
<div id="test">www.koyoz.com</div>
</body>
</html>
1. 在index.html执行JS直接访问:
JavaScript代码
document.getElementById('koyoz').contentWindow.document.getElementById
('test').style.color='red'
通过在index.html访问ID名为'koyoz'的iframe页面,并取得此iframe页面内的ID为'test'的
对象,并将其颜色设置为红色.
此代码已经测试通过,能支持IE/firefox .
2. 在index.html里面借助jQuery访问:
JavaScript代码
$("#koyoz").contents().find("#test").css('color','red');
此代码的效果和JS直接访问是一样的,由于借助于jQuery框架,代码就更短了.
收集网上的一些示例:
用jQuery在IFRAME里取得父窗口的某个元素的值
只好用DOM方法与jquery方法结合的方式实现了
1. 在父窗口中操作 选中IFRAME中的所有单选钮
$(window.frames["iframe1"].document).find("input:radio").attr("checked","true");
2. 在IFRAME中操作 选中父窗口中的所有单选钮
$(window.parent.document).find("input:radio").attr("checked","true");
父窗口想获得IFrame中的Iframe,就再加一个frames子级就行了,如:
$(window.frames["iframe1"].frames["iframe2"].document).find("input:radio").attr("checked","true");
发表评论
-
40个有创意的jQuery图片和内容滑动及弹出插件收藏集之三
2014-12-09 10:33 752原文地址:http://www.techo ... -
241个jquery插件—jquery插件大全
2014-12-09 10:26 772原文地址:http://blog.csdn.net/adsda ... -
前端ui的js框架
2014-09-04 16:45 562原文地址:http://www.quickui.net/v3/ ... -
2014 年最火的21个JavaScript框架
2014-09-03 17:25 451原文地址:http://www.iteye.com/news/ ... -
Bootstrap 栅格系统
2014-08-08 15:53 491原文地址:http://www.cnblogs.com/lin ... -
自定义Bootstrap
2014-08-08 10:14 661原文地址:http://www.w3cplus.com/css ... -
使用python/casperjs编写终极爬虫-客户端App的抓取
2014-08-06 18:09 9281.缘起 随着移动互 ... -
使用Selenium和PhantomJS解析带JS的网页
2014-08-06 17:57 1020有的网页,不能直接通过wget/curl等命令、或者直接使用P ... -
数据抓取的艺术(一):Selenium+Phantomjs数据抓取环境配置
2014-08-06 17:56 598原文地址:http://blog.chin ... -
ubuntu12.04 下安装nodejs【整理】
2014-06-12 14:38 689ubuntu12.04 下安装nodejs【整理】 作者:杭州 ... -
Ubuntu安装nodeJS
2014-06-12 14:38 479Ubuntu安装nodeJS 安装环境 ubuntu12. ... -
纯js页面跳转整理
2014-05-20 18:06 492纯js页面跳转整理 js页面跳转 js方式的页面跳转 1. ... -
细说Cookie
2013-09-29 15:14 625细说Cookie 阅读目录 开始 ... -
JavaScript Source Map 详解
2013-08-30 09:49 772JavaScript Source Map 详解 ... -
9 个超实用的 jQuery 代码片段
2013-07-15 14:49 734jQuery以其强大的功能和简单的使用成为了前端开发者最喜欢 ... -
前端工具导航
2013-07-11 14:36 965http://f2e.im/static/pages/nav ... -
主题:50个令人惊奇的jQuery插件
2013-05-29 18:17 961jQuery拥有强大的有创造性的程序员群体。 然而,它很难通 ... -
jquery触发事件
2013-05-23 17:25 578Snandy Stop, thinking is th ... -
jquery事件命名空间
2013-05-23 17:13 480JQUERY事件命名空间 2012 ... -
jQuery的事件命名空间-Namespaced Events
2013-05-23 17:12 606jQuery的事件命名空间-Namespaced Event ...
相关推荐
JQUERY实现iframe页面切换功能,轻松简单、灵活方便快速,代码实例,测试通过
jquery.iframe-transport.js包
jquery iframe动态添加tab选项卡 jquery iframe动态添加tab选项卡 jquery iframe动态添加tab选项卡 jquery iframe动态添加tab选项卡 jquery iframe动态添加tab选项卡 jquery iframe动态添加tab选项卡 jquery iframe...
jquery.iframe-transport.js
jquery iframe tab实例 jquery iframe tab实例 jquery iframe tab实例 jquery iframe tab实例 可实现动态添加或删除tab页
jQuery-1.8.3(&2.1.4).min.js&jquery;.fileupload&jquery;.iframe-transport
jquery tab 切换页面 支持iframe 有iframe引用示例
很好用的一个选项卡插件,需要和自己页面样式一样,可以改一些css就可以了
jQuery内嵌iframe导航菜单
jquery对iframe自适应高度插件是国外下载下来的。插件使用只要引用js文件就行,不用做任何别的操作完全自动化。
简单实用的Jquery弹出层,附带样式,redme文档,看了立马就会
本人开发的积累总结,Iframe模拟Ajax 可以跨越的操作。
本文实例分析了jQuery取得iframe中元素的常用方法。分享给大家供大家参考,具体如下: jquery取得iframe中元素的几种方法: 在iframe子页面获取父页面元素 代码如下: 复制代码 代码如下:$(‘#objId’, parent....
两个jquery实现iframe多标签页例子.我现在的asp.net项目正在使用
我的博客地址 http://blog.csdn.net/qq413041153/article/details/7397622 更新日志2012-05-05: 修复了几个bug: 1,iframe在没有指定宽和高时默认全屏的bug 2,当iframe隐藏时的错误显示效果 3,当iframe以tab...
之前写过一个JQuery竖排Tab的代码示例,现在补充写了一个横排的,并结合了iframe的使用,自己项目的样式或者一些补充功能都可以基于此示例延伸开发
打包好了直接下载可用。运行main.html。但代码显示有乱码,自己修改查。
示例的目的是iframe中弹出窗口后,遮罩层能遮盖整个可视区域,能让弹出层返回参数到iframe页面,也可以在弹出层直接提交,直接提交用jquery.form.js插件。 代码有详细注释,麻烦慢慢琢磨,有问题可qq联系,505074122
主要介绍了jquery得到iframe src属性值的方法,很简单,很实用,需要的朋友可以参考下
前端项目-jquery.iframe-transport,jQuery plugin that implements an iframe transport so that ajax calls support the uploading of files using standard HTML file input fields