时间:2021-07-01 10:21:17 帮助过:41人阅读
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<iframe src="http://www.b.com/b.html" ></iframe>
<ul id="getText"></ul>
<script>
function dosome(text){
document.getElementById("getText").innerHTML= decodeURI(text);
}
</script>
</body>
</html>
b.html
代码如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<iframe id="myfarme" src="###"></iframe>
<ul id="ct">
<li>这里是内容1</li>
<li>这里是内容2</li>
<li>这里是内容3</li>
<li>这里是内容4</li>
<li>这里是内容5</li>
<li>这里是内容6</li>
</ul>
<script>
window.onload = function(){
var text = document.getElementById('ct').innerHTML;
document.getElementById('myfarme').src="http://www.a.com/c.html?content="+encodeURI(text);
}
</script>
</body>
</html>
c.html
代码如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.onload = function(){
var text = window.location.href.split('=')[1]
console.log(parent.parent)
parent.parent.dosome(text);
}
</script>
</head>
<body>
ddddddddddd
</body>
</html>