[Javascript] Help : writting to message box in iframe

Peter-Paul Koch gassinaumasis at hotmail.com
Tue Oct 1 05:07:28 CDT 2002


>I have a form with the following set in the page
>
>
>            <div id="html_viewer_message" class="html_editor" 
>style="background-color:white;position:relative;top:-2px;">
>                <iframe id="styled_text_message" name="styled_text_message" 
>style="height:250px;font-family:Arial, Helvetica"></iframe>
>            </div>
>
>
>On  selecting an appropriate parameter, I need to append the value in the 
>above form field with the 'code'  using Javascript.  However I am having 
>trouble referring it. The code that I am currently looking at is
>
>document.all.styled_text_message.value += '\n' + code + '\n';

You're treating the iframe as if it were a form field. It isn't, it's an 
iframe and it has nothing to do with a form.

Besides you're using document.all so your script will only work in Explorer.

See http://www.xs4all.nl/~ppk/js/index.html?iframe.html for some tips on 
changing iframe content.

ppk

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




More information about the Javascript mailing list