1
有誰知道如何從HTMLbox富文本編輯器中檢索文本?從HTMLbox中檢索文本
有誰知道如何從HTMLbox富文本編輯器中檢索文本?從HTMLbox中檢索文本
Htmlbox只是一個擴展在html元素textarea上的插件。您可以像正常的textarea html元素那樣對待它。 對於如..
$(function()
{
$('#textboxid').htmlbox({
toolbars:[
[
"separator","bold","italic","underline","strike","sup","sub",
"separator","removeformat"
],
["separator","fontsize","fontfamily","fontcolor","highlight"]
],
skin:"blue"
});
alert($('#textboxid').val());
}
要使用HtmlBox的內置功能,這樣做: 分配htmlbox()給一個變量的迴歸,然後使用該變量(例如hb_full.get_html()調用HtmlBox的方法;或任何其他方法)。看下面的代碼示例。
<script type="text/javascript">
var hb_full;
$(document).ready(function(){
hb_full = $("#htmlbox_full").css("height", "300").css("width", "100%").htmlbox({
toolbars: [
[
// Cut, Copy, Paste
"separator", "cut", "copy", "paste",
// Undo, Redo
"separator", "undo", "redo",
// Bold, Italic, Underline, Strikethrough, Sup, Sub
"separator", "bold", "italic", "underline", "strike", "sup", "sub",
// Left, Right, Center, Justify
"separator", "justify", "left", "center", "right",
// Ordered List, Unordered List, Indent, Outdent
"separator", "ol", "ul", "indent", "outdent",
// Hyperlink, Remove Hyperlink, Image
"separator", "link", "unlink", "image"
],
[
// Show code
"separator", "code",
// Formats, Font size, Font family, Font color, Font, Background
"separator", "formats", "fontsize", "fontfamily",
"separator", "fontcolor", "highlight",
],
[
//Strip tags
"separator", "removeformat", "striptags", "hr", "paragraph",
// Styles, Source code syntax buttons
"separator", "quote", "styles", "syntax"
]
],
about: true, // "false" to hide About button
idir: "./img/HtmlBoxImg/",
icons: "default", //all options: "default", "silk"
skin: "blue" //all options: "silver", "blue", "green", "red"
});
});
function getHtmlFromEditor()
{
var HtmlFromEditor = hb_full.get_html();
alert(HtmlFromEditor);
}
</script>
<textarea id="htmlbox_full"></textarea>
<button onclick="getHtmlFromEditor();">Display HTML</button>
如何處理HTMLbox上的JavaScript注入? – user384080 2010-07-06 05:51:58
現在回答此問題?任何人?? – user384080 2010-07-08 05:28:26