function insertSmilies(smilieid) {
var src = getbyid("smilie_" + smilieid).src;
var code = getbyid("smilie_" + smilieid).alt;
code += " ";
AddText(code);
}
function AddText(txt) {
obj = getbyid("xspace-commentform").message;
selection = document.selection;
if (!obj.hasfocus) {
obj.focus();
}
if (typeof obj.selectionStart != "undefined") {
var opn = obj.selectionStart + 0;
obj.value = obj.value.substr(0, obj.selectionStart) + txt + obj.value.substr(obj.selectionEnd);
} else if (selection && selection.createRange) {
var sel = selection.createRange();
sel.text = txt;
sel.moveStart("character", - strlen(txt));
} else {
obj.value += txt;
}
}
posted on 2008-10-21 21:16
汪杰 阅读(209)
评论(1) 编辑 收藏 引用 所属分类:
javascript