i am planning on kind of editor by replacing the textarea with iframe so that i could edit the content with rich html.
I am facing weird problem and i cannot set the value of iframe innerHTML with the value of textarea while loading.
what could be the problem. here is the code.
[code=html]
var myeditor;
window.onload = function()
{
myeditor = document.getElementById(‘rte’).contentWindow.document;
myeditor.designMode = “on”;
}
function Start(obj,width,height) {
document.write(“<img src=”bold.gif” name=”btnBold” onClick=”doClick(‘bold’)”>”);
document.write(“<img src=”italic.gif” name=”btnItalic” onClick=”doClick(‘italic’)”>”);
document.write(“<img src=”underline.gif” name=”btnUnderline” onClick=”doClick(‘underline’)”>”);
document.write(“<img src=”link.gif” name=”btnLink” onClick=”doLink()”>”);
document.write(“<img src=”unlink.gif” name=”btnUnlink” onClick=”doClick(‘unlink’)”>”);
document.write(“<img src=”picture.gif” name=”btnPicture” onClick=”doImage()”>”);
document.write(“<br>”);
document.write(“<iframe id=”rte” width=”” + width + “” height=”” + height + “” style=”border:1px solid grey”></iframe>”);
LoadData(obj);
}
function LoadData(obj)
{
myeditor.body.innerHTML= document.getElementById(obj).value;
document.getElementById(obj).style.visibility=”hidden”;
}
[code=html]
<form action=”” method=”post” >
<p>
<textarea name=”mybox” id=”mybox” >This is a <b>bold</b> sample textarea</textarea>
<script>Start(‘mybox’,600,400);
</script>
</p>
<p>
<input type=”submit” name=”Submit” value=”Submit”>
</p>
</form>
what am i doing wrong here?