假设 a.html:
<body>
<iframe id="i1" src="b.html"></iframe>
<iframe id="i2" src=""></iframe>
</body>
<script> </script>
假设 b.html:
<body><td id="info">点击</td></body>
a.html中js如何写才能得在a.html点击 b.html时。使得i2动态包含其他界面?
<html>
<body>
<iframe id='aframe' onload="a_click()" src="www.baidu.com"></iframe>
<iframe id='bframe' src=""></iframe>
</body>
<script>
function a_click(){
document.getElementById('aframe').contentDocument.onclick=function(e){ document.getElementById('bframe').src="http://opinion.haiwainet.cn/n/2015/0321/c456317-28551440.html";
}
}
</script>
</html>
我说的不是这个意思,是aframe包含的页面中写js。问题已经解决了用parent获得父页面。