//设置表情
//str 新添加的字符串
function shezhiBq(str)
{
var obj = document.getElementById("rl_exp_input");//获取文本框
obj.focus();
if (document.selection) {
var sel = document.selection.createRange();
sel.text = str;
alert('a');
} else if (typeof obj.selectionStart == 'number' && typeof obj.selectionEnd == 'number') {
var startPos = obj.selectionStart,
endPos = obj.selectionEnd,
cursorPos = startPos,
tmpStr = obj.value;
obj.value = tmpStr.substring(0, startPos) + str + tmpStr.substring(endPos, tmpStr.length);
var jj=tmpStr.substring(0, startPos) + str; //当新字符串添加后的光标位置
obj.selectionStart = obj.selectionEnd =jj.length; //设置新光标位置在新添加字符串的后面
alert(obj.selectionStart);
} else {
obj.value += str;
}
}