【问题标题】:Write the iframe text into the textarea and load it into the database将 iframe 文本写入 textarea 并加载到数据库中
【发布时间】:2016-11-23 14:48:07
【问题描述】:

我想要我的 iframe 中的文本在我的 textarea 中,所以我可以上传格式化的文本。但它不起作用。我有一个数据库连接,我可以从其他 Textarea 上传标题。

这是将 Iframetext 放入 Textarea 的代码。

function submit(){
var iframe = document.getElementById('editor').contentWindow.document.write('textarea');
submit.elements['textarea'].value = window.frames['editor'].document.body.innerHTML;
submit.submit();;}

这是我的 HTML 代码。

    <div id="edits" name="functions" class="col-4">
    <center>
    <input type="button" onclick="runCommand('Bold');" value="B" style="font-weight:bold;"></input>
    <input type="button" onclick="runCommand('underline');" value="U" style="text-decoration: underline;"></input>
    <input type="button" onclick="runCommand('italic');" value="K" style="font-style:italic;"></input>
    </center>
</div>

<div id="placeholder1" class="col-4 ph">_</div><div id="palceholder1" class="col-4 ph">_</div><div id="placeholder1" class="col-4 ph">_</div>

<textarea id="textarea" name="textarea" class="col-4" style="display:none;"></textarea>
<iframe name="editor" id="editor" placeholder="Hier den Text eingeben." class="col-4"></iframe>

<div id="placceholder1" class="col-4 ph">_</div>
<div id="buttons" class="col-4">
<input type="button" onclick="submit()" name="upload" value="Upload">
</div></br>

你能帮帮我吗?

【问题讨论】:

标签: javascript php iframe textarea


【解决方案1】:

您可以将 iframe 的整个代码存储在一个变量中,例如 var code = document.getElementById("IFRAME").innerHTML; 将代码作为字符串发送到数据库

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-26
    • 1970-01-01
    • 2013-12-09
    • 1970-01-01
    相关资源
    最近更新 更多