javascript - How to put PHP content into an iframe? -
i have iframe
, want put php content in in text-area.
<textarea><?php echo $content; ?></textarea>
but not work iframe
. how can solve it?
code:
<form action="php_parsers/article_parser.php" id="writearticle" name="writearticle" method="post"> <p style="text-align: center; font-size: 22px;">create article</p> <textarea name="title" id="title" type="text" maxlength="100" placeholder="article title"></textarea> <div class="toolbar"> <a onclick="ibold()"><i class='fa fa-bold'></i></a> <a onclick="iunderline()"><i class='fa fa-underline'></i></a> <a onclick="iitalic()"><i class='fa fa-italic'></i></a> <a onclick="ifontsize()"><i class='fa fa-font'></i></a> <a onclick="iforecolor()"><i class='fa fa-align-left'></i></a> <a onclick="ihorizontalrule()"><i class='fa fa-align-center'></i></a> <a onclick="iunorderedlist()"><i class='fa fa-list-ul'></i></a> <a onclick="iorderedlist()"><i class='fa fa-list-ol'></i></a> <a onclick="ilink()"><i class='fa fa-link'></i></a> <a onclick="iunlink()"><i class='fa fa-chain-broken'></i></a> <a onclick="ijustleft()"><i class='fa fa-align-left'></i></a> <a onclick="ijustcenter()"><i class='fa fa-align-center'></i></a> <a onclick="ijustright()"><i class='fa fa-align-right'></i></a> <a onclick="iimage()"><i class='fa fa-picture-o'></i></a> </div> <!-- hide(but keep) normal textarea , place in iframe replacement --> <textarea style="display:none;" name="mytextarea" id="mytextarea" cols="100" rows="14"></textarea> <iframe name="richtextfield" id="richtextfield"></iframe> <!-- end replacing normal textarea --> <br /> <br /> <button id="article_btn" onclick="savearticle()">save article</button> <br /> <br /> <br /> </form>
i tested , works fine:
document.documentelement.innerhtml = '<iframe id="frame"></iframe>'; var frame = document.getelementbyid('frame').contentwindow.document; frame.open(); frame.write('<html><body>it works!</body></html>'); frame.close();
you can on rendered iframe.
Comments
Post a Comment