/    Sign up×
Community /Pin to ProfileBookmark

move textarea value to iframe

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]

[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>
[/code]

what am i doing wrong here?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @olddocks spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...