发表日期: 2021-05-22 10:42:10 浏览次数:79
吕梁网站推广【吕梁办理400电话】吕梁SEO优化、吕梁微信公众号APP客户端小程序开发、吕梁网站托管、吕梁APP开发

吕梁市位于山西省中部西侧,因吕梁山脉由北向南纵贯全境而得名。西隔黄河同陕西榆林相望,东北与省会太原市相连,东部、东南部分别和晋中、临汾接壤。全市基本属于温带大陆性季风气候区,冬寒夏暑,四季分明。市境总面积2.1万平方千米,下辖1个市辖区、10个县,代管2个县级市,市政府驻离石区。
吕梁是革命老区,革命战争时期是红军东征主战场、晋绥边区首府和中央后委机关所在地。一部《吕梁英雄传》,是战争年代吕梁人民不畏牺牲、前赴后继的真实写照。 吕梁是发展新区,于2003年撤地设市,是山西省最年轻的地级市,代管的孝义市是山西省县域经济发展的排头兵。
2020年10月20日,吕梁市入选全国双拥模范城(县)名单。 [1]
1.parent.html
<html>
<head>
<title>parent.html</title>
<meta charset="utf-8">
<script language="javascript" type="text/javascript" src="http://www.bolue.cn/js/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
var hello = 'hello';
function getHelloWorld() {
console.log('hello world');
}
</script>
</head>
<body>
<div id="default" style=" width:200px; height:400px; float:left;">parent.html</div>
<iframe id="iframeid" src="iframe.html" style=" width:400px; height:400px; float:left;"></iframe>
<iframe id="mainFrame" src="iframexxx.html" style=" width:400px; height:400px; float:left;"></iframe>
</body>
</html>2.iframe.html
<html>
<head>
<title>iframe.html</title>
<meta charset="utf-8">
<script language="javascript" type="text/javascript" src="http://www.bolue.cn/js/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(function() {
//在iframe中查找父页面元素
console.log("在iframe中查找父页面元素:$('#default', window.parent.document).html()===");
console.log($('#default', window.parent.document).html());
//在iframe中调用父页面中定义的方法
console.log('在iframe中调用父页面中定义的方法');
parent.getHelloWorld();
//在iframe中调用父页面中定义的变量
console.log('在iframe中调用父页面中定义的变量');
console.log(parent.hello);
console.log('在iframe中调用父页面中的另一个iframe方法1');
console.log(window.parent.window.frames['mainFrame']);
console.log('在iframe中调用父页面中的另一个iframe方法2');
console.log(window.parent.document.getElementById("mainFrame"));
});
</script>
</head>
<body>
<form id="form1">
<div id="iframe">
iframe.html
</div>
</form>
</body>
</html>3.iframexxx.html
<html> <head> <meta charset="utf-8"> <title>iframexxx.html</title> </head> <body> iframexxx.html滴答滴答嗲嗲 </body> </html>
4.上结果图

5.再贴下iframe.html中的代码
$(function() {
//在iframe中查找父页面元素
console.log("在iframe中查找父页面元素:$('#default', window.parent.document).html()===");
console.log($('#default', window.parent.document).html());
//在iframe中调用父页面中定义的方法
console.log('在iframe中调用父页面中定义的方法');
parent.getHelloWorld();
//在iframe中调用父页面中定义的变量
console.log('在iframe中调用父页面中定义的变量');
console.log(parent.hello);
console.log('在iframe中调用父页面中的另一个iframe方法1');
console.log(window.parent.window.frames['mainFrame']);
console.log('在iframe中调用父页面中的另一个iframe方法2');
console.log(window.parent.document.getElementById("mainFrame"));
});