<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 13, comments - 7, trackbacks - 0, articles - 0

    在線HTML編輯器htmlarea簡(jiǎn)單使用

    Posted on 2007-02-07 13:47 趙永超 閱讀(1334) 評(píng)論(1)  編輯  收藏 所屬分類: Html

    ?

    這幾步是如果使用htmlarea3.0的說明,是在網(wǎng)上看到的. 在/htmlarea/examples/web-menu這個(gè)文件里有更為詳細(xì)的說明.下邊的這個(gè)鏈接的版本是多國(guó)語(yǔ)言版本,默認(rèn)的語(yǔ)言為英語(yǔ).

    ??? 下載HTMLarea3.0 http://www.jhdown.com/soft/8/141/html/2006220010681.html,解壓里面的文件到web站點(diǎn)的/htmlarea目錄下(可以是自己建的目錄,這里建議直接用htmlarea做為目錄);

    二、定義javascript的全局變量及引入js文件:

    ?<script type="text/javascript">
    ?? _editor_url = "${pageContext.request.contextPath}/htmlarea/";
    ?? _editor_lang = "en";
    </script>

    <script type="text/javascript" src="${pageContext.request.contextPath}/htmlarea/htmlarea.js"></script>

    <script type="text/javascript">
    var editor = null;
    function initEditor() {
    ? editor = new HTMLArea("content");
    ? editor.generate();
    }
    </script>

    有句editor = new HTMLArea("content");"content"是表單中textarea屬性的id,如:

    ????? <html:form action="/actionBbsreply.do?method=update" onsubmit="this['content'].value=editor.getHTML();">
    ??????? <textarea cols="110" rows="15" id="content" name="content">
    ????????? <bean:write name="bbsreply" property="content"/>
    ??????? </textarea>
    ??????? <html:submit value=" 提 交 ">
    ??????? </html:submit>
    ????? </html:form>

    三、在body的onload事件中加載initEditor():

    ? 如:<body bgcolor="#ffffff" onload="initEditor()">

    四、注意點(diǎn):

    1、editor = new HTMLArea("content");參數(shù)值是表單中textarea屬性id;

    2、在body的onload事件中加載initEditor();

    3、表單onsubmit事件調(diào)用this['content'].value=editor.getHTML()

    在使用的過程中發(fā)現(xiàn),因?yàn)槟J(rèn)是英文語(yǔ)方,提示信息也是英文的, 這對(duì)于飛慣用中文的朋友來(lái)說很是不方便 ,如果要改變語(yǔ)言的話
    ?? _editor_lang = "en";
    把上邊代碼里的._editor_lang="gb"理論上就可以了, 這樣,當(dāng)代碼去運(yùn)行的時(shí)候會(huì)找/lang文件夾下的gb.js文件,但是作者發(fā)布這套源代碼的時(shí)候jb.js里的中文是用iso8859-1編碼的,我用MyEclipse的javascriptEdit查看器(MyEclipse下*.js的默認(rèn))打開的時(shí)候看到的全是亂碼,這就導(dǎo)至了在jsp頁(yè)面出現(xiàn)錯(cuò)誤.解決的辦法就是在改變gb.js的文件的屬性, 將編碼格式改為utf-8的格式. 然后再加上en.js下邊的
    ?buttons: {
    ? "ok":?????????? "確定",
    ? "cancel":?????? "取消"
    ?},

    ?msg: {
    ? "Path":???????? "路徑",
    ? "TEXT_MODE":??? "現(xiàn)在模式是文本模式.? 按[<>]鍵切換到可視化編輯模式.",

    ? "IE-sucks-full-screen" :
    ? // translate here
    ? "The full screen mode is known to cause problems with Internet Explorer, " +
    ? "due to browser bugs that we weren't able to workaround.? You might experience garbage " +
    ? "display, lack of editor functions and/or random browser crashes.? If your system is Windows 9x " +
    ? "it's very likely that you'll get a 'General Protection Fault' and need to reboot.\n\n" +
    ? "You have been warned.? Please press OK if you still want to try the full screen editor."
    ?},

    ?dialogs: {
    ? "Cancel"??????????????????????????????????????????? : "Cancel",
    ? "Insert/Modify Link"??????????????????????????????? : "Insert/Modify Link",
    ? "New window (_blank)"?????????????????????????????? : "New window (_blank)",
    ? "None (use implicit)"?????????????????????????????? : "None (use implicit)",
    ? "OK"??????????????????????????????????????????????? : "OK",
    ? "Other"???????????????????????????????????????????? : "Other",
    ? "Same frame (_self)"??????????????????????????????? : "Same frame (_self)",
    ? "Target:"?????????????????????????????????????????? : "Target:",
    ? "Title (tooltip):"????????????????????????????????? : "Title (tooltip):",
    ? "Top frame (_top)"????????????????????????????????? : "Top frame (_top)",
    ? "URL:"????????????????????????????????????????????? : "URL:",
    ? "You must enter the URL where this link points to"? : "You must enter the URL where this link points to"
    ?}

    這些代碼.如果有需要的話, 可以把右邊屬性的值翻譯成漢語(yǔ),這里還有一個(gè)要注意的地方就是要對(duì)照格式,我把我改正過的貼到這里, 方便查看

    // I18N constants -- Chinese GB
    // by Dave Lo -- dlo@interactivetools.com
    HTMLArea.I18N = {

    ?// the following should be the filename without .js extension
    ?// it will be used for automatically load plugin language.
    ?lang: "gb",

    ?tooltips: {
    ? bold:?????????? "粗體",
    ? italic:???????? "斜體",
    ? underline:????? "底線",
    ? strikethrough:? "刪除線",
    ? subscript:????? "下標(biāo)",
    ? superscript:??? "上標(biāo)",
    ? justifyleft:??? "位置靠左",
    ? justifycenter:? "位置居中",
    ? justifyright:?? "位置靠右",
    ? justifyfull:??? "位置左右平等",
    ? orderedlist:??? "位置左右平等",
    ? unorderedlist:? "無(wú)序清單",
    ? outdent:??????? "減小行前空白",
    ? indent:???????? "加寬行前空白",
    ? forecolor:????? "文字顏色",
    ? backcolor:????? "背景顏色",
    ? horizontalrule: "水平線",
    ? horizontalrule: "水平標(biāo)尺",
    ? createlink:???? "插入連結(jié)",
    ? insertimage:??? "插入圖形",
    ? inserttable:??? "插入表格",
    ? htmlmode:?????? "切換HTML原始碼",
    ? popupeditor:??? "放大",
    ? about:????????? "關(guān)於 HTMLArea",
    ? help:?????????? "說明",
    ? textindicator:? "字體例子"
    ?},


    ?buttons: {
    ? "ok":?????????? "確定",
    ? "cancel":?????? "取消"
    ?},

    ?msg: {
    ? "Path":???????? "路徑",
    ? "TEXT_MODE":??? "現(xiàn)在模式是文本模式.? 按[<>]鍵切換到可視化編輯模式.",

    ? "IE-sucks-full-screen" :
    ? // translate here
    ? "The full screen mode is known to cause problems with Internet Explorer, " +
    ? "due to browser bugs that we weren't able to workaround.? You might experience garbage " +
    ? "display, lack of editor functions and/or random browser crashes.? If your system is Windows 9x " +
    ? "it's very likely that you'll get a 'General Protection Fault' and need to reboot.\n\n" +
    ? "You have been warned.? Please press OK if you still want to try the full screen editor."
    ?},

    ?dialogs: {
    ? "Cancel"??????????????????????????????????????????? : "Cancel",
    ? "Insert/Modify Link"??????????????????????????????? : "Insert/Modify Link",
    ? "New window (_blank)"?????????????????????????????? : "New window (_blank)",
    ? "None (use implicit)"?????????????????????????????? : "None (use implicit)",
    ? "OK"??????????????????????????????????????????????? : "OK",
    ? "Other"???????????????????????????????????????????? : "Other",
    ? "Same frame (_self)"??????????????????????????????? : "Same frame (_self)",
    ? "Target:"?????????????????????????????????????????? : "Target:",
    ? "Title (tooltip):"????????????????????????????????? : "Title (tooltip):",
    ? "Top frame (_top)"????????????????????????????????? : "Top frame (_top)",
    ? "URL:"????????????????????????????????????????????? : "URL:",
    ? "You must enter the URL where this link points to"? : "You must enter the URL where this link points to"
    ?}
    };

    呵呵.文件改好了以后,就把這個(gè)文件復(fù)制到/plugins/下.(在plugins下有5個(gè)子文件夾,每個(gè)又文件夾下有一個(gè)lang文件夾,把gb.js文件放進(jìn)去就OK了.)
    然后啟動(dòng),成功了...^_^


    趙永超原創(chuàng),轉(zhuǎn)載請(qǐng)注明

    ?


    ?

    Feedback

    # re: 在線HTML編輯器htmlarea簡(jiǎn)單使用  回復(fù)  更多評(píng)論   

    2009-09-13 22:58 by 附屬物

    夫頂替 壓頂 侉
    主站蜘蛛池模板: 一级一级毛片免费播放| 天天影视色香欲综合免费| 国精无码欧精品亚洲一区| 一级毛片免费毛片一级毛片免费| www.亚洲日本| 中文字幕亚洲综合久久男男| 84pao强力永久免费高清| 老司机亚洲精品影院在线观看| 在线亚洲精品福利网址导航| 美女被免费喷白浆视频| 黄色短视频免费看| 久久久久se色偷偷亚洲精品av| 亚洲精品第一国产综合精品99| 最近2019中文字幕免费大全5 | 亚洲精品成人久久久| 1区2区3区产品乱码免费| 美女的胸又黄又www网站免费| 91亚洲导航深夜福利| 免费人妻无码不卡中文字幕18禁| 久久国产色AV免费看| 一级成人生活片免费看| 亚洲最大中文字幕无码网站| 亚洲AV永久无码精品一百度影院| 日本免费一区二区三区最新| 无码少妇精品一区二区免费动态| 视频一区二区三区免费观看| 亚洲神级电影国语版| 亚洲成AV人片在线观看WWW| 亚洲精品无码激情AV| 在线jlzzjlzz免费播放| 国产精品久久久久久久久免费| 99热在线日韩精品免费| 国产AV日韩A∨亚洲AV电影| 亚洲午夜久久久精品电影院| 国产亚洲成av人片在线观看| 免费在线观看中文字幕| 国产老女人精品免费视频| 在线精品一卡乱码免费| 91精品手机国产免费| 国产午夜精品免费一区二区三区| 日韩在线观看视频免费|