javascript:function setSelectText(editor, text) { if (!editor) return; editor.focus(); if (editor.document && editor.document.selection) editor.document.selection.createRange().text = text; else if (typeof(editor.selectionStart) != "undefined") { var str = editor.value; var start = editor.selectionStart; editor.value = str.substr(0, start) + text + str.substring(editor.selectionEnd, str.length); editor.selectionStart = start + text.length; editor.selectionEnd = start + text.length; } } function getEditor() { var replyframe = parent.document.getElementById("replyframe"); if (replyframe) return replyframe.contentWindow.document.getElementById("tb_ReplyBody___Editor"); else return document.getElementById("ctl00_ctl00_CPH_Content_CPH_BaseContent_tb_TopicBody___Editor"); } function imgClick(src) { var editor = getEditor(); if (editor) setSelectText(editor, "[img=" + src + "]图[/img]"); if (typeof closeWindow == "function") closeWindow(); else MzModalDialog.close(); } function imageDialog() { if (typeof showWindow == "undefined" && typeof MzModalDialog == "undefined") return; var htmlDialog = "<div width='100%' height='100%'>\n"; for (var i = 0; i <= 134; i++) htmlDialog += "<img src='http://p.blog.csdn.net/images/p_blog_csdn_net/renrousousuo/" + i + ".gif' onclick='imgClick(this.src);'>\n"; htmlDialog += "</div>\n"; if (typeof showWindow == "function") showWindow({html:htmlDialog, width:450, height:300, title:'选择表情'}); else MzModalDialog.open(htmlDialog, {width:450, height:300, title:'选择表情'}); } imageDialog();