how to use innerHTML for preview in Kevin Roth's rte

Discussion in 'JavaScript' started by mel03, Dec 8, 2006.

  1. #1
    Hi,

    I am trying to install Kevin Roth's Cross-Browser Rich Text Editor on my website.
    I would like to show preview of the content when the submit button is clicked using the javascript innerHTML function.
    Can anyone help?

    The form code is below:
    
    <form name="RTEDemo" action="demo.htm" method="post" onsubmit="return submitForm();">
    
    <!--
    function submitForm() {
    //make sure hidden and iframe values are in sync for all rtes before submitting form --- this is the part that I don't understand
    	updateRTEs(); //how should I write the funtion here for preview using innerHTML
    
    }
    
    //Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML, encHTML)
    
    initRTE("./images/", "./", "", false);
    
    //build new richTextEditor
    var rte1 = new richTextEditor('rte1');
    rte1.html = 'here's the "\<em\>preloaded\<\/em\>&nbsp;\<b\>content\<\/b\>"';
    //below would be the script to build the rte
    //
    
    rte1.build();
    //-->
    </script>
    
    <p><input type="submit" name="submit" value="Preview" /></p>
    </form>
    
    Code (markup):

    where should I add the iframe and hidden values for the form?
    Also how to use the innerHTML code for preview?
    Thanks.

    The full code for the html form is attached.

    Melissa
     

    Attached Files:

    • rte.txt
      File size:
      3.6 KB
      Views:
      134
    mel03, Dec 8, 2006 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    Urm, I'm very lazy and can't be bothered to look for the script, so a link would be nice, I had a go at how I think it'll work, but dunno the element id of the editor itself, and I'll need that....if you got a link to the ive script that'd be more helpful that a link to the script....
    EDIT : oops I think I scared her off with my overpowering laziness, sorry about that
     

    Attached Files:

    krakjoe, Dec 8, 2006 IP