如何在 iframe 中断开单词
How to break words in an 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>
还有脚本:我省略了更改为文本的函数,使代码更清晰。
function iframe(){
editor.document.designMode = 'on';}
您可以尝试使用 CSS3 word-break
属性。
http://www.w3schools.com/cssref/css3_pr_word-break.asp
相关文章:
- 当鼠标悬停在文本中的单词上时显示警报
- 匹配一个单词,其中候选人可以跨越顺序组(跨度)
- 如何使用jquery强制一个单词更改大小写等以保留品牌
- 拆分单词jquery
- 如何让程序检查所选单词中是否有按键
- 如何在悬停时流畅地更改单词
- EmberJS中支持单字母单词模型
- 字母计数:返回重复字母数最多的第一个单词
- 如何在Javascript中从字符串中提取某些单词
- 如何创建一个“;表单弹出框“;在chrome中右键单击时位于突出显示的单词上方
- 在javascript中查找单词
- 使用jQuery检查提交时添加到句子中的单词
- 如何在PHP中获取特定的字符串单词
- 停止较大单词的重叠
- 我们如何在互联网断开连接或用户关闭选项卡/浏览器时调用注销servlet
- 如何在没有单词的情况下从命令行运行Node.js程序'节点'
- 服务器上的Meteor客户端断开连接事件
- 用于匹配不带字符的单词的正则表达式
- 如何在 iframe 中断开单词
- 如何查找html元素是否应用了换行,并且该单词在文本中间断开