Using execCommand to edit an existing HTML page

E

Edd Read

Hi,

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
non-existant.

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

Thanks for your help!

Regards
Edd
 
I

Ivo

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.
Iv
 

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

No members online now.

Forum statistics

Threads
474,151
Messages
2,570,854
Members
47,394
Latest member
Olekdev

Latest Threads

Top