代码如下:var iframeids = [memberIndexIframe,inquiryCenterIframe,everychinaBbsIframe]; var iframehide = "yes"; function dynIframeSize(){ var dyniframe = []; for(var i=0;i<iframeids.length;i++){ if(!document.getElementById) return false; dyniframe[i] = document.getElementById(iframeids[i]); if(dyniframe[i] && !window.opera){ dyniframe[i].style.display = "block"; if(dyniframe[i].contentDocument && dy...
代码如下:<%@ page contentType="text/html; charset=GBK" language="java"%> <%@ page import="com.jstrd.mm.business.sysmgr.monitor.logic.MMStock2BudgetLogic" %> <% String query = request.getParameter("query"); MMStock2BudgetLogic bean = new MMStock2BudgetLogic(); String xmldata = bean.statStock2Budget(); %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <META HTTP-EQUI...
父页面代码 代码如下:<!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=utf-8" /> <title>无标题文档</title> </head> <body> <div style="height:300px; background-color:#CC9900"></div> <div> <iframe src="test_iframe.html"...
代码如下:<script type="text/javascript"> function getIframeContent(){ //获取iframe中文档内容 var doc; if (document.all){//IE doc = document.frames["MyIFrame"].document; }else{//Firefox doc = document.getElementById("MyIFrame").contentDocument; } return doc.body.innerHTML; } </script>
这是一篇原创翻译文章。原文地址。我们会经常使用iframes来加载第三方的内容、广告或者插件。使用iframe是因为他可以和主页面并行加载,不会阻塞主页面。当然使用iframe也是有利有弊的:Steve Souders在他的blog里面有阐述:Using Iframes Sparingly:iframe会阻塞主页面的onload事件 主页面和iframe共享同一个连接池 阻塞主页面的onload是这两个问题中最影响性能的方面。一般都是想让onload时间越早触发越好,一方面是用户体验过...
作者: think8848(公司主页: http://www.cleversoft.com, QQ: 166156888, Blog: http://think8848.cnblogs.com) 转载请保留此信息CleverTabs是一款jQuery插件,所需jQuery版本:1.6.1,jQuery UI样式版本:1.8.13;其功能为创建jQuery UI风格的Tab用于显示iframe。 本示例中符加了jQuery.contextMenu插件,我修改了其样式,使用了jQuery UI的皮肤 效果如下图: 初级应用示例: HTML代码: <div id="tabs"><ul></ul></div> Javascript代...
html结构如下: 代码如下:<html> <head> <title>为body添加click事件</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script type="text/javascript" src="jquery-1.5.2.js"></script> <script> function show_body_click(){ alert(you are click the body); } jQuery(document).ready(function(){ //jQuery("ifr_id").contents().find("body").attr("onclick", "show_body_click()"); //alert(jQ...
代码如下:<script type="text/javascript"> function reinitIframe(){ var iframe = document.getElementById("mainFrame"); try{ var bHeight = iframe.contentWindow.document.body.scrollHeight; var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; var height = Math.max(bHeight, dHeight); iframe.height = height; }catch (ex){} } window.setInterval("reinitIframe()", 200); </script>
<iframe id= "myframe" ></iframe> W3C的标准告诉我们,可以通过Dom对象的contentDocument属性来返回文档对象。 即 代码如下:doc= document.getElementById(myframe ).contentDocument 但对IE浏览器来说,经过测试,IE6,IE7都不支持,IE8开始支持了。 在IE下,需要这样来访问 代码如下:document.frames[myframe].document; 跨浏览器的解决方案是, contentWindow属性,这是个只读属性,返回指定的iframe的窗口对象。 它虽然不...
父窗口中操作iframe:window.frames["iframeChild"].document //假如iframe的id为iframeChild 在子窗口中操作父窗口:window.parent.document 那么,用如果想用jquery的方法,我们怎么用jquery来获取iframe呢?下面是一下收集来的方法。 获取页面的对象其实就是dom方法外面加上jquery的选择符: 父窗口中操作iframe:$(window.frames["iframeChild"].document) //假如iframe的id为iframeChild 在子窗口中操作父窗口:$(window.pare...
一、父窗口调用iframe子窗口方法 1、HTML语法:<iframe name="myFrame" src="child.html"></iframe> 2、父窗口调用子窗口:myFrame.window.functionName(); 3、子窗品调用父窗口:parent.functionName(); 简单地说,也就是在子窗口中调用的变量或函数前加个parent.就行 4、父窗口页面源码: 代码如下:<html> <head> <script type="text/javascript"> function say() { alert("parent.html------>Im at parent.html"); } function c...
代码如下:$(window.parent.document).find("#Frm_Main").attr("src",url); 使用jquery操作iframe 1 内容里有两个ifame <iframe id="leftiframe"...</iframe> <iframe id="mainiframe..</iframe> leftiframe中jQuery改变mainiframe的src代码: $("#mainframe",parent.document.body).attr("src","//www.gxlcms.com ") 2 如果内容里面有一个ID为mainiframe的ifame <iframe id="mainifame"...></ifame> ifame包含一个someID <div id="...
采用的方法很类似: 代码如下:var iframe = document.createElement("iframe"); iframe.src = "//www.gxlcms.com"; if (!/*@cc_on!@*/0) { //if not IE iframe.onload = function(){ alert("Local iframe is now loaded."); }; } else { iframe.onreadystatechange = function(){ if (iframe.readyState == "complete"){ alert("Local iframe is now loaded."); } }; } document.body.appendChild(iframe); 最近, Nicholas C. Z...
jquery有个很不错的ui插件,dialog插件,他的官方网站上有各种形式的演示:http://jqueryui.com/demos/dialog/ ,可能大家用得比较多的还是它的默认模式,具体的用法官网上都有,也有中文的讲解地址,我就不再重复了,最近在弄弹出框架页,仔细一看,和dialog插件的modal form 模式很相似,demo演示效果:http://www.lovewebgames.com/addNews.aspx 就是这么个效果,要进行登录注册弹出层,至于为什么我不直接用modal form来做呢?...
从父页面中选择iframe中的元素: 代码如下:$(#btnCancel,$(#PopFrame)[0].contentWindow.document) 从iframe页面中选择父页面中的元素: 代码如下:$("#PopContainer",parent.document) 以下内容是别的网友的解决方法:只好用DOM方法与jquery方法结合的方式实现了 1.在父窗口中操作 选中IFRAME中的所有单选钮 $(window.frames["iframe1"].document).find("input[@type=radio]").attr("checked","true"); 2.在IFRAME中操作 选中父...