how to append text to HTML displayed in iframe

Discussion in 'Javascript' started by Mel, Mar 22, 2005.

  1. Mel

    Mel Guest

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

    thanks
     
    Mel, Mar 22, 2005
    #1
    1. Advertising

  2. Mel wrote:

    > 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);
    }

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 22, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sm
    Replies:
    2
    Views:
    540
    Rolf Magnus
    Apr 29, 2005
  2. boney
    Replies:
    1
    Views:
    568
  3. HYRY
    Replies:
    10
    Views:
    608
    Bruno Desthuilliers
    Sep 26, 2007
  4. Koms Bomb
    Replies:
    1
    Views:
    116
    Koms Bomb
    Jul 1, 2003
  5. Daedalous
    Replies:
    3
    Views:
    705
    Daedalous
    Jan 16, 2004
Loading...

Share This Page