admin管理员组文章数量:1426292
i have a javascript problem
there are three html page like 'page1.html', 'anotherPage.html' and anotherPage.html
FOR page1.html
<div id='mainFrame'></div>
<ul><li onclick="updateFrame(id,"anotherPage.html");"><a href="javascript:;"></a></li></ul>
FOR anotherPage.html
<ul><li onclick="updateFrame(id,anotherPage2);"><a href="javascript:;"></a></li></ul>
my javascript function:
function updateFrame(id,url){
document.getElementById(id).innerHTML="<iframe scrolling='no' style='height:2000px;position:absolute;width:100%;height:100%;left:10px;border-style:none' src=\" "+ url+ "\"></iframe>";}
The problem is that when i called java script in iframe, javascript did not find the parent document id. How can i access the parent document id ? (Parent document is another html page in this case)
Thanks.
i have a javascript problem
there are three html page like 'page1.html', 'anotherPage.html' and anotherPage.html
FOR page1.html
<div id='mainFrame'></div>
<ul><li onclick="updateFrame(id,"anotherPage.html");"><a href="javascript:;"></a></li></ul>
FOR anotherPage.html
<ul><li onclick="updateFrame(id,anotherPage2);"><a href="javascript:;"></a></li></ul>
my javascript function:
function updateFrame(id,url){
document.getElementById(id).innerHTML="<iframe scrolling='no' style='height:2000px;position:absolute;width:100%;height:100%;left:10px;border-style:none' src=\" "+ url+ "\"></iframe>";}
The problem is that when i called java script in iframe, javascript did not find the parent document id. How can i access the parent document id ? (Parent document is another html page in this case)
Thanks.
Share Improve this question edited Aug 7, 2011 at 15:05 s.onal asked Aug 7, 2011 at 15:00 s.onals.onal 271 gold badge2 silver badges6 bronze badges1 Answer
Reset to default 1parent.document.getElementById('myControlId')
本文标签: javascripthow to access element id which belongs to another html pageStack Overflow
版权声明:本文标题:javascript - how to access element id which belongs to another html page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745460623a2659309.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论