
正文
jquery评论,jQuery用法
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
jquery 如何实现评论内容即时显示
如果你只要前端显示的话就用DOM,创建一个onclick函数,var newText=document.getElementById("...").value; ,然后创建新文本var addText=createTextnode(newText);,再在评论列表.appendChild(addText);
如果要保存在服务器再从中读取的话就得用AJAX了
相关问答
Q1: Jquery怎样实现Ctrl+Enter组合键快捷发表评论
jQuery 实现 Ctrl+Enter 快捷键发表评论 jquery代码:
script language="javascript"
jQuery(document).keypress(function(e){
if(e.ctrlKey e.which == 13 || e.which == 10) {
jQuery("#commentForm").submit();
} else if (e.shiftKey e.which==13 || e.which == 10) {
jQuery("#commentform").submit();
}
})
/script
重点介绍:
在ff中 判断 ctrl+enter 是 e.ctrlKey e.which ==13
在ie6中 判断ctrl+enter 是 e.ctrlKey e.which ==10
其他案例:
textarea name="comment" id="comment" tabindex="4" /textarea
改成:
textarea name="comment" id="comment" tabindex="4" onkeydown="if(event.ctrlKeyevent.keyCode==13){document.getElementById('submit').click();return false};"/textarea
以上是为大家分享的Ctrl+Enter实现发表的代码,当在文本域内使用组合键Ctrl+Enter怎样实现发布的代码,供大家参考学习。
Q2: Jquery显示评论有点问题
//试试这样呢?
$.each($('.bottom'),function(index,value){
(function(i){
$(this).on('click','.comment',function(){
//作判断,需登录才能显示出评论框
if($.cookie('userName')){
if($('.comment_list').eq(i).is(':hidden')){
$('.comment_list').eq(i).show();
}else{
$('.comment_list').eq(i).hide();
}
}else{
$('#error').dialog('open');
setTimeout(function(){
$('#login').dialog('open');
$('#error').dialog('close');
},1000);
}
})(index)
});




![[ActionScript 3.0] AS3.0 对象在一定范围随机显示不重叠 [ActionScript 3.0] AS3.0 对象在一定范围随机显示不重叠](https://www.04ip.com/template/qe/style/noimg/10.jpg)

