开发者

how to access element id which belongs to another html page?

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:abso开发者_开发百科lute;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.


parent.document.getElementById('myControlId')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜