日期:2014-05-17  浏览次数:20984 次

在留言板中加入心情图标
类似论坛心情图标的功能
点一下心情图标,直接在 <textarea> 中以图片的方式显示出来
不要radio选取那种
谁能给个代码
谢谢了


------解决方案--------------------
自己调整一下表格,加点图片就好了。

EmotionImg.js
function showEmotionImg() {
document.write( " <table width=328 border=0 cellspacing=0 cellpadding=0 bgcolor=#FFFFFF> ");
var cols = 11; //列
var rows = 4; //行
//表情说明
var ArrEmo= new Array( "装可爱 ", "88 ", "kiss ", "摇滚 ", "xmen超人 ", "挨打 ", "扮鬼脸 ", "被炸了 ", "鄙视 ", "高傲 ", "大吃一惊 ", "无奈了 ", "点头 ", "无语 ", "生气 ", "扶眼镜装斯文 ", "感冒流鼻涕 ", "害羞 ", "惊讶 ", "高兴 ", "流泪 ", "狂怒 ", "大笑 ", "困 ", "流汗 ", "吵架 ", "吐 ", "抛媚眼 ", "装可爱 ", "色眯眯 ", "不开心 ", "装酷 ", "睡着了 ", "举白旗投降 ", "吐舌头 ", "微笑 ", "郁闷 ", "无奈了 ", "发呆 ", "奸笑 ", "疑惑 ", "阴险 ", "意外受伤 ", "当头一锤 ");
for (i=0; i <rows; i++) {
document.write( " <tr align=center> ");
j = i*cols;
for (; j <i*cols + cols; j++) {
//var tips = e_arr[j];
document.write( " <td> <img src=Images/Emotion/ " + j + ".gif title= "+ArrEmo[j]+ " style= 'cursor:hand ' onclick=EmotionStr( " + j + ") </td> ");//title= "+j+ ">
}
document.write( " </tr> ");
}
document.write( " </table> ");
}
function EmotionStr(num) {
document.adform.content.value += '[em '+[num]+ '] ';
document.adform.content.focus();
}
showEmotionImg();


test.asp
<form name= "adform " action= " " method= "post " onSubmit= "return CheckForm(); ">
<textarea name= "content " cols= "85 " rows= "6 " class= "selStyle "> </textarea>
<script language= "javascript " src= "EmotionImg.js "> </script>
</form>