how to append text to HTML displayed in iframe

M

Martin Honnen

Mel said:
how can i add text to an html that is displayed in an iframe ?

You simply need to access the document in the iframe and then use the
normal DOM methods to create and append stuff e.g. with
<iframe name="iframeName" src="whatever.html" ...></iframe>
you could (once the iframe document is loaded) do
var iframeDoc = window.frames.iframeName.document;
var text;
if (iframeDoc.createTextNode && (text =
iframeDoc.createTextNode('Kibology for all.'))) {
iframeDoc.body.appendChild(text);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top