By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

Using execCommand to edit an existing HTML page

P: n/a

I have made a basic WYSIWYG editor using the execCommand functions. I
use an iFrame as the editing area and so far I have managed to create
documents from a blank page and save them to a database.

What I am having problems doing is editing an existing HTML document.
Until now I have used a button with onclick element as follows to
populate the iFrame with the current HTML:

onclick="iEditor.document.body.innerHTML = '<font color=#000066>This is
a test page';"

[where iEditor is the iFrame]

The hassle of having to click a button to populate the editor is
annoying, so I have tried to run this command at the <body onload="...
stage however I get an error saying the object iView.document.body is

Can anyone offer any advice (or links to any advice) regarding this

Thanks for your help!


Edd Read
+44 (0)7929 130229
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Doesn't sound like the execCommand is causing the problem. Are you not
confusing the documents in different frames? One does not
automatically know when the other has loaded. If it hasn't, especially
when the <body> opening tag has not yet been written, there may be the
answer why iView.document.body is non-existant.
Perhaps post a bit more code, so we know what iEditor and iView are.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.