insert simple text into iframe ? not .htm file

17,712

Solution 1

An iFrame is used to display content from another page, so you would have to put the text on the other page and then display that page in the iframe.

If the page being iframed has a textarea on it, then yes you will be able to type into the text area from the first page that is iframing the page with the textarea on it.

Solution 2

Assuming your iframe is named "Editor" then you can enter text into it by:

<script language="javascript">var text_to_edit = "some text"; window.frames['Editor'].document.body.innerHTML = text_to_edit; </script>
Share:
17,712
mm.
Author by

mm.

Updated on June 04, 2022

Comments

  • mm.
    mm. about 2 years

    is it possible to insert simple text into iframe ? trying to do small texteditor with this tutorial

    http://www.devarticles.com/c/a/HTML/Building-a-WYSIWYG-HTML-Editor-Part-1/

    and want to have some text in iframe, which i can then change.. but i don't want to get that text from some external html file.

    it is possible to insert text into iframe , just like in textarea for example ? thanks