View Full Version : how to use innerHTML for preview in Kevin Roth's rte

12-08-2006, 06:33 PM

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.
Kevin has a usage example here (http://www.kevinroth.com/rte/usage.htm)but I still can't fiigure out it works.

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


<p><input type="submit" name="submit" value="Preview" /></p>

where should I add the iframe and hidden values for the form?



12-08-2006, 07:00 PM
Well, the first thing that jumps out at me is that the first line of code you have here is HTML and the rest is JavaScript. For the beggining use the HTML Tags (<HTML></HTML>) and for the JScript, use the JScript Tags (<Script Language=JavaScript></Script>)

Otherwise the browser can't distiguish the difference in languages.