qq表情插件的使用

编程入门 行业动态 更新时间:2024-10-28 04:30:40

qq表情<a href=https://www.elefans.com/category/jswz/34/1771202.html style=插件的使用"/>

qq表情插件的使用

引入js文件
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.qqFace.js"></script>
js代码块
$(function(){$('.emotion').qqFace({id : 'facebox', //表情盒子的IDassign:'saytext', //给输入框赋值path:'face/'	//表情存放的路径});// 提交按钮触发的事件$(".sub_btn").click(function(){// 获取输入的textarea里面的内容var str = $("#saytext").val();// 提交后展示区的内容$("#show").html(replace_em(str));});
});
//查看结果
function replace_em(str){// 替代小于号str = str.replace(/\</g,'<');// 替代大于号str = str.replace(/\>/g,'>');// 换行str = str.replace(/\n/g,'<br/>');str = str.replace(/\[em_([0-9]*)\]/g,'<img src="face/$1.gif" border="0"/>');return str;
}
css代码块
ment{width:680px; margin:20px auto; position:relative}
ment h3{height:28px; line-height:28px}
/* 所有内容的显示区 */
_form{width:100%;position:relative;}
.input{width:99%; height:60px; border:1px solid #ccc}
_form p{height:28px; line-height:28px; position:relative}
span.emotion{width:42px; height:20px; background:url(icon.gif) no-repeat 2px 2px; padding-left:20px; cursor:pointer}
/* 鼠标悬浮上去换定位 */
span.emotion:hover{background-position:2px -28px}
.qqFace{margin-top:4px;background:#fff;padding:2px;border:1px #dfe6f6 solid;}
.qqFace table td{padding:0px;}
.qqFace table td img{cursor:pointer;border:1px #fff solid;}
.qqFace table td img:hover{border:1px #0066cc solid;}
#show{width:680px; margin:20px auto}
/* 设置提交按钮属性 */
.sub_btn {position:absolute; right:0px; top:0;margin: 0 2px;cursor: pointer;text-align: center;padding: .5em 2em .55em;
}
/* 鼠标悬浮在提交按钮上时的显示属性 */
.sub_btn:hover {background: #538018;
}
body文本
<div id="main">
<!-- 显示评论结果的地方 --><div id="show"></div><div class="comment"><div class="com_form"><!-- 评论输入框 --><textarea class="input" id="saytext" name="saytext"></textarea><p><input type="button" class="sub_btn" value="提交"><span class="emotion">表情</span></p></div></div>    
</div>





更多推荐

qq表情插件的使用

本文发布于:2024-03-10 03:48:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1726928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   表情   qq

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!