简体   繁体   中英

document.write entire page, not just frame

I've got an HTML page with several frames. I run a javascript in one of the frames to rewrite the entire page, ie get rid of all frames and rewrite the whole page. But document.write only writes the frame it's written in. How can I do this with javascript?

Cheers

If the frame and container are both on the same domain, you can use parent.document to access the whole HTML page.

If they are on different domain, you cannot do this due to security restrictions.

The global javascript object window.frames contains all frames. From this point you can edit all parts of your page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM