⑴ 点击颜文字输入到编辑框js代码请教
<!doctypehtml>
<html>
<head>
<metacharset="UTF-8">
</head>
<body>
<divid="ds-thread">
<divid="ds-reset">
<textareaname="message"id="comment"title="Ctrl+Enter快捷提交"placeholder="说点什么吧…"></textarea>
<ahref="javascript:yanwenzishuru();"id="yanwenzikaiguan">[颜文字关]</a>
<divclass="yanwenzi"><aclass="label">(⌒▽⌒)</a><aclass="label">( ̄▽ ̄)</a><aclass="label">(=・ω・=)</a><aclass="label">(`・ω・´)</a><aclass="label">(〜 ̄△ ̄)〜</a><aclass="label">(・∀・)</a><aclass="label">(°∀°)ノ</a><aclass="label">( ̄3 ̄)</a><aclass="label">╮( ̄▽ ̄)╭</a><aclass="label">(´_ゝ`)</a><aclass="label">←_←</a><aclass="label">(<_<)</a><aclass="label">(>_>)</a><aclass="label">(;¬_¬)</a><aclass="label">(゚Д゚≡゚д゚)!?</a><aclass="label">Σ(゚д゚;)</a><aclass="label">Σ( ̄□ ̄||)</a><aclass="label">(´;ω;`)</a><aclass="label">(/TДT)/</a></div>
</div>
<scriptsrc="jquery-1.11.3.min.js"></script>
<scripttype="text/javascript">
varchangeMsg="[颜文字开]";varcloseMsg="[颜文字关]";
functionyanwenzishuru(){jQuery('.yanwenzi').slideToggle('fast',function(){
if(jQuery('.yanwenzi').css('display')=='none'){
jQuery('#yanwenzikaiguan').text(changeMsg);
}else{
jQuery('#yanwenzikaiguan').text(closeMsg);}
});
}
jQuery(document).ready(function(){
jQuery('.yanwenzi').hide();
jQuery('.yanwenzi').click(function(e){
varstr=$('#comment').val();
str+=$(e.target).html();
$('#comment').val(str);
});
});
</script>
</body>
</html>