1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<!-- 首先,它需要jQuery来辅助,所以第一步当然是载入jQuery --> <script type="text/javascript" src="jquery.js"></script> <!-- 然后载入它的两个js文件 bueditor.js 和 library/default_buttons_functions.js --> <!-- 它们都放在bueditor目录下面 --> <script type="text/javascript" src="bueditor/bueditor.js"></script> <script type="text/javascript" src="bueditor/library/default_buttons_functions.js"></script> <!-- 然后是样式表文件 --> <link type="text/css" rel="stylesheet" href="bueditor/bueditor.css" /> <!-- 接着就是设置菜单和icons的目录 --> <script type="text/javascript"> <!--//-->< ![CDATA[//><!-- BUE.templates.e1 = { "iconpath": "bueditor/icons", // 这里就是icons的目录了 "buttons": [ // 这些菜单如果你觉得有需要可以自己再加一点,我就是这么做的 :) [ "Insert/edit image", "js:\nvar B = eDefBrowseButton(\'/imce\', \'attr_src\', \'Browse\', \'image\');\nvar form = [\n {name: \'src\', title: \'Image URL\', suffix: B},\n {name: \'width\', title: \'Width x Height\', suffix: \' x \', getnext: true, attributes: {size: 3}},\n {name: \'height\', attributes: {size: 3}},\n {name: \'alt\', title: \'Alt text\'}\n];\neDefTagDialog(\'img\', form, \'Insert/edit image\', \'OK\');\n", "image.gif", "M" ], [ "Insert/edit link", "js:\nvar form = [\n {name: \'href\', title: \'Link URL\', suffix: B},\n {name: \'html\', title: \'Link text\'},\n {name: \'title\', title: \'Link title\'}\n];\neDefTagDialog(\'a\', form, \'Insert/edit link\', \'OK\');\n", "link.gif", "L" ], [ "tpl:", "", "separator.png", "" ], [ "Bold", "\x3cstrong\x3e%TEXT%\x3c/strong\x3e", "b.gif", "B" ], [ "Italic", "js: eDefTagger(\'em\');", "i.gif", "I" ], [ "Underline", "js: eDefTagger(\'u\');", "u.gif", "U" ], [ "Headers", "js: eDefTagChooser([\n [\'h1\', \'Header1\'],\n [\'h2\', \'Header2\'],\n [\'h3\', \'Header3\'],\n [\'h4\', \'Header4\']\n], true, \'li\', \'ul\', \'slideDown\');", "header.gif", "H" ], [ "tpl:", "", "separator.png", "" ], [ "Center", "<p style=\"text-align:center\">%TEXT%", "ac.gif", "AC" ], [ "Left", "<p style=\"text-align:left\">%TEXT%</p>", "al.gif", "AL" ], [ "Right", "<p style=\"text-align:right\">%TEXT%</p>", "ar.gif", "AR" ], [ "tpl:", "", "separator.png", "" ], [ "Paragraph", "js: eDefTagger(\'p');", "p.gif", "P" ], [ "Blockquote", "js: eDefTagger(\'blockqoute\');", "bq.gif", "Q" ], [ "Ordered list. Converts selected lines to a numbered list.", "js: eDefTagLines(\'\x3col\x3e\\n\', \' \x3cli\x3e\', \'\x3c/li\x3e\', \'\\n\x3c/ol\x3e\');", "ol.gif", "O" ], [ "Unordered list. Converts selected lines to a bulleted list.", "js: eDefTagLines(\'\x3cul\x3e\\n\', \' \x3cli\x3e\', \'\x3c/li\x3e\', \'\\n\x3c/ul\x3e\');", "ul.gif", "U" ], [ "tpl:", "", "separator.png", "" ], [ "More", "\x3c!--more--\x3e", "more.gif", "Mn" ], [ "Preview", "js: eDefPreview();", "preview.gif", "P" ], [ "Help", "js: eDefHelp(\'slideDown\');", "help.gif", "F" ] ] }; //-->< !]]> </script> <!-- 最后,push 一个数组放到 BUE.preset里,第一个是你textarea的id ,但最好是id和name这样更标准些;第二个值就是在上面看到的BUE.templates.e1了 --> <script type="text/javascript"> <!--//-->< ![CDATA[//><!-- BUE.preset.push(['memo','e1']); //-->< !]]> </script> |