Javascript 如何在iframe中打断单词

Javascript 如何在iframe中打断单词,javascript,html,css,iframe,Javascript,Html,Css,Iframe,我一直在编写一个文本编辑器教程进行练习,遇到了iframe的一个问题。如果一个人在没有空格的情况下发送一个字符的垃圾邮件,iframe将创建一个滚动条,而不是打断这个单词。如何修复此问题,使文字换行的行为类似于文字区域?编辑:例如,如果有人写“@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

我一直在编写一个文本编辑器教程进行练习,遇到了iframe的一个问题。如果一个人在没有空格的情况下发送一个字符的垃圾邮件,iframe将创建一个滚动条,而不是打断这个单词。如何修复此问题,使文字换行的行为类似于文字区域?编辑:例如,如果有人写“@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@。我宁愿把比iframe的宽度长的字弄断,这样它才合适

<body onLoad = "iframe()">


<h1 class="titlehead"> Title:</h1>
<form method = "post" action = "submit.php" id = "rtf">
<div class="threadpostcont">
    <input type="text" name="title" class="titleinput" placeholder="Title here"></input>
    <br>
    <input id = "bolder" class = "textbut" type = "button" value = "Bold" onclick = "bold()">
    <input class = "textbut" type = "button" value = "Italicize" onclick = "italic()">
    <input class = "textbut" type = "button" value = "Underline" onclick = "underline()">
    <input class = "textbut" type = "button" value = "Font Size" onclick = "fontsize()">
    <input class = "textbut" type = "button" value = "Colour" onclick = "fontcolor()">  
    <input class = "textbut" type = "button" value = "Strike Through" onclick = "strike()">
    <input class = "textbut" type = "button" value = "Link" onclick = "link()">
    <input class = "textbut" type = "button" value = "Unlink" onclick = "unlink()">
    <input class = "textbut" type = "button" value = "Picture" onclick = "picture()">
    <input class = "textbut" type = "button" value = "List" onclick = "unlist()">
    <br>
    <textarea name = "textarea" id = "textarea" style = "display: none;"></textarea>
    <iframe name = "editor" id = "editor" class="theframe"></iframe>
    <br><br>
    <input type = "button" onclick = "formsubmit()" value = "Post" id="threadsend">
    </form>
    </div>
    </body>

您可以尝试使用CSS3
wordbreak
属性


在任何正常情况下,你都不应该呼吸单词。w3schools仍然是一个糟糕的参考资料。请给出一个导致所述问题的内容的实际示例,并指定如何将文本分成几行。Textarea格式非常特殊。如果您确实希望在任意点打断单词,而不以任何方式表明某个单词已被打断,则应将其包含在问题中。在编辑中添加。是的,我希望比iframe的宽度长的字符串被打断。
function iframe(){
editor.document.designMode = 'on';}