Using execCommand to edit an existing HTML page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Edd Read

    Using execCommand to edit an existing HTML page

    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="iEdito r.document.body .innerHTML = '<font color=#000066>T his 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

    --
    Edd Read
    mail@eddreadREM OVE_ME.co.uk
    This website is for sale! eddread.co.uk is your first and best source for all of the information you’re looking for. From general topics to more of what you would expect to find here, eddread.co.uk has it all. We hope you find what you are searching for!

    +44 (0)7929 130229
  • Ivo

    #2
    Re: Using execCommand to edit an existing HTML page

    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

    Comment

    Working...