⑴ 點擊顏文字輸入到編輯框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>