I am facing weird problem and i cannot set the value of iframe innerHTML with the value of textarea while loading. The idea is hide the textarea after moving the value to iframe rich text editor.
what could be the problem. here is the code
Expand|Select|Wrap|Line Numbers
- 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";
- }
- [/html]
- [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>