JQ写的插入表情帮忙看看火狐怎样才能兼容
时间:2009-06-04
来源:互联网
$(document).ready(function(){
$("#faceselect").hide();
$("#insertface").click(function(){
$("#faceselect").toggle();
});
$("#faceselect img").click(function(){
$("#faceselect img").removeClass("face");
$(this).addClass("face");
$("textarea").append("<img src='"+$(this).attr("src")+"' />");
});
$("#faceclose").click(function(){
$("#faceselect").hide();
});
$("#tijiao").click(function(){
var aa=$("textarea").html();
$("form").attr("action","ceshi.asp?neirong="+aa);
});
});
<!--HTML代码-->
<form method="post">
<div id="edit"><label id="insertface">插入表情</label></div>
<textarea id="neirong" name="neirong" style="overflow:hidden;"></textarea><br />
<input type="submit" id="tijiao"/>
<div id="faceselect">
<div id="faceclose">关闭表情</div>
<img src="image/em01.gif" /><img src="image/face3.png" />
</div>
</form>
IE兼容·但火狐不兼容·火狐到这1步:$("textarea").append("<img src='"+$(this).attr("src")+"' />"); 插不进去
但是换成HTML()或text()就可以·如果这么做的话内容会被覆盖·应该要怎样解决???
$("#faceselect").hide();
$("#insertface").click(function(){
$("#faceselect").toggle();
});
$("#faceselect img").click(function(){
$("#faceselect img").removeClass("face");
$(this).addClass("face");
$("textarea").append("<img src='"+$(this).attr("src")+"' />");
});
$("#faceclose").click(function(){
$("#faceselect").hide();
});
$("#tijiao").click(function(){
var aa=$("textarea").html();
$("form").attr("action","ceshi.asp?neirong="+aa);
});
});
<!--HTML代码-->
<form method="post">
<div id="edit"><label id="insertface">插入表情</label></div>
<textarea id="neirong" name="neirong" style="overflow:hidden;"></textarea><br />
<input type="submit" id="tijiao"/>
<div id="faceselect">
<div id="faceclose">关闭表情</div>
<img src="image/em01.gif" /><img src="image/face3.png" />
</div>
</form>
IE兼容·但火狐不兼容·火狐到这1步:$("textarea").append("<img src='"+$(this).attr("src")+"' />"); 插不进去
但是换成HTML()或text()就可以·如果这么做的话内容会被覆盖·应该要怎样解决???
[ 此帖被arice在2009-06-04 12:36重新编辑 ]
作者: arice 发布时间: 2009-06-04
textarea只能显示文本,IE的实现是不标准的
如果非要实现的话,可以设置DOM的contentEditable属性为true
或document.designMode='on';
例子:
http://www.keakon.cn/bbs/thread-1364-1-1.html
如果非要实现的话,可以设置DOM的contentEditable属性为true
或document.designMode='on';
例子:
http://www.keakon.cn/bbs/thread-1364-1-1.html
[ 此帖被keakon在2009-06-04 13:05重新编辑 ]
作者: keakon 发布时间: 2009-06-04
怎么换···能不能演示个实例
作者: arice 发布时间: 2009-06-04
我知道了怎么弄了!!谢谢2楼的提示
作者: arice 发布时间: 2009-06-04
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28