ajax如何在java聊天应用程序中添加笑脸功能? 1 周,1 日 Questions & Answers 3521 在我的聊天应用程序中,我需要添加笑脸功能吗?我怎样才能做到这一点 我们正在使用“Genesys”创建聊天应用程序 可以添加笑脸吗 请任何人都能帮助我 先谢谢你
# 1 楼答案 你可以这样做Pure CSS/JS Emoticons 或 可以用图像替换文本 查看示例、源代码和此jsFiddle Demonstration 样本 var emoticons = { smile: '<img src="path/smile.gif" />', sad: '<img src="path/sad.gif" />', wink: '<img src="path/wink.gif" />' }; var patterns = { smile: /:-\)/gm, sad: /:-\(/gm, wink: /;-\)/gm }; $(document).ready(function() { $('p').each(function() { var $p = $(this); var html = $p.html(); $p.html(html.replace(patterns.smile, emoticons.smile). replace(patterns.sad, emoticons.sad). replace(patterns.wink, emoticons.wink)); }); }); 更多信息 jsFiddle Demonstration JQuery: Inserting Emoticons(来源)
# 1 楼答案
你可以这样做Pure CSS/JS Emoticons
或
可以用图像替换文本
查看示例、源代码和此jsFiddle Demonstration
样本
更多信息