JQuery $.ajax 本帖最后由 sujunlin_1987 于 2010-03-13 19:57:41 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jQuery中通过ajaxStart()和ajaxStop()两个方法提供了类似的功能 $(".info_reply_text").click(function (){ var id=$(this).attr("id"); var html="<textarea id=nontent"+id+" name='infoNontent' style='width:100%;'></textarea>"; $(".info_text_"+id).html(html).show(); $(".info_reply_"+id).hide(); $(".info_reply_"+id).next().show(); var id="nontent"+id; KE.init({ id : id, resizeMode : 1, height:"150px", cssPath : './css/global.css', items : ['emoticons'] }); KE.create(id); KE.util.pToBr(id);});$("div[id^='info_submit_']").click(function (){ var id=$(this).attr("id").slice(12,15); var nontent = KE.util.getData("nontent"+id);//获取kindeditor编辑器中的内容 var infoAddressee=$("input[id='info_addressee_"+id+"']").val(); var infoParent=$("input[id='info_parent_"+id+"']").val(); if(nontent=="" || nontent=="<br />"){ $("#error_infoNontent_"+id).text("内容不可为空!"); return false; }else{ $("#error_infoNontent_"+id).text(""); nontent=encodeURIComponent(nontent); $('#loading').show(); $.ajax({ url:"./user/info_add_save.php", type:"POST", dataType:"html", data:"nontent="+nontent+"&infoAddressee="+infoAddressee+"&infoParent="+infoParent, success: function(html){ if(html==1){ var url=$("#right_nav span:first-child").attr("url"); $(".hor_nav1").removeClass("hor_nav3"); $("#right_nav span:first-child").addClass("hor_nav3"); $("#right_main div:first-child").load(url+"?rnd="+Math.random(),function(){ $("#right_main div:first-child").fadeIn(0,function(){ $('#loading').hide(); }); }); } } }); }}); <div class="info_reply_style"> <div class="info_text_<?=$rs['infoID']?>" style="line-height:0px;font-size:0px;display:none"></div> <div class="info_reply_<?=$rs['infoID']?>"><div id="<?=$rs['infoID']?>" class="info_reply_text">回复短消息...</div></div> <div style="display:none;margin-top:4px;width:100%"> <input type="hidden" name="info_addressee" value="<?=$rs['userID']?>" id="<?="info_addressee_".$rs['infoID']?>"> <input type="hidden" name="info_parent" value="<?=$rs['infoID']?>" id="<?="info_parent_".$rs['infoID']?>"> <div class="input_button_outer"><div id="info_submit_<?=$rs['infoID']?>" class="input_button_style" style="width:45px;">确 定</div></div> <div class="input_button_outer"><div id="info_reset_<?=$rs['infoID']?>" class="input_button_style" style="width:45px;">取 消</div></div> <div id="error_infoNontent_<?=$rs['infoID']?>" class="input_error" style="height:18px;line-height:18px;"></div> <div class="clear"></div> </div> </div><div id="loading"><div>正在处理中...</div></div>#loading{ height:20px; border:1px solid #8ab7e9; margin:1px 5px; position:absolute; bottom:0; right:0; z-index:100; background:url(../upload/loading.gif) no-repeat 2px #f3f3f3; display:none;}.info_reply_style{ line-height:16px; padding:4px; border:1px solid #594946; margin-top:4px; position:relative;}.info_reply_text{ cursor:text; width:100%;}.input_button_outer{ border:1px solid #b4b4b4; padding:1px; float:left; margin-left:6px; display:inline; height:14px; line-height:16px; _line-height:18px; overflow:hidden;}.input_button_style{ font-size:12px; width:90px; height:14px; cursor:pointer; border:0px; background:url(../upload/button_bg.gif) repeat-x; text-align:center; color:#333333;} 请你相信是你的js脚本导致的图片静止的,在你处理ajax返回结果时效率太慢,js在全负荷运行时gif会卡的,通常gif在ajax请求返回前绝对不会卡的,不信你把后台方法sleep几十秒看看,优化你的中间处理代码吧,这样的问题我在写grid标签的时候遇到过,jQuery的性能还不能满足快速的大数据的复杂操作 opener到底怎么用的? 一个小小问题 为什么embed XP下没声音 简单传值问题 如何提取"a$b$ c$d$e f$ga$b$ c$d$e f$ga$b$ c$d$e f$g..."中两个"$"内的内容 兼容性问题 如何去掉<FONT></FONT>标签? 通过子窗口给父窗口的text赋值,为什么不成功? 新手小白求解 为何不输出 求给个 手机端响应式轮播插件 在同一页面能多次使用的!!急急~~ 怎样使同一页面中的部分文本框的值不重复和所有的文本框内容不能为空? 请大家帮帮忙看看和分析一下这段诡异的JS代码!!!
$(".info_reply_text").click(function (){
var id=$(this).attr("id");
var html="<textarea id=nontent"+id+" name='infoNontent' style='width:100%;'></textarea>";
$(".info_text_"+id).html(html).show();
$(".info_reply_"+id).hide();
$(".info_reply_"+id).next().show();
var id="nontent"+id;
KE.init({
id : id,
resizeMode : 1,
height:"150px",
cssPath : './css/global.css',
items : ['emoticons']
});
KE.create(id);
KE.util.pToBr(id);
});
$("div[id^='info_submit_']").click(function (){
var id=$(this).attr("id").slice(12,15);
var nontent = KE.util.getData("nontent"+id);//获取kindeditor编辑器中的内容
var infoAddressee=$("input[id='info_addressee_"+id+"']").val();
var infoParent=$("input[id='info_parent_"+id+"']").val();
if(nontent=="" || nontent=="<br />"){
$("#error_infoNontent_"+id).text("内容不可为空!");
return false;
}else{
$("#error_infoNontent_"+id).text("");
nontent=encodeURIComponent(nontent);
$('#loading').show();
$.ajax({
url:"./user/info_add_save.php",
type:"POST",
dataType:"html",
data:"nontent="+nontent+"&infoAddressee="+infoAddressee+"&infoParent="+infoParent,
success: function(html){
if(html==1){
var url=$("#right_nav span:first-child").attr("url");
$(".hor_nav1").removeClass("hor_nav3");
$("#right_nav span:first-child").addClass("hor_nav3");
$("#right_main div:first-child").load(url+"?rnd="+Math.random(),function(){
$("#right_main div:first-child").fadeIn(0,function(){
$('#loading').hide();
});
});
}
}
});
}
}); <div class="info_reply_style">
<div class="info_text_<?=$rs['infoID']?>" style="line-height:0px;font-size:0px;display:none"></div>
<div class="info_reply_<?=$rs['infoID']?>"><div id="<?=$rs['infoID']?>" class="info_reply_text">回复短消息...</div></div>
<div style="display:none;margin-top:4px;width:100%">
<input type="hidden" name="info_addressee" value="<?=$rs['userID']?>" id="<?="info_addressee_".$rs['infoID']?>">
<input type="hidden" name="info_parent" value="<?=$rs['infoID']?>" id="<?="info_parent_".$rs['infoID']?>">
<div class="input_button_outer"><div id="info_submit_<?=$rs['infoID']?>" class="input_button_style" style="width:45px;">确 定</div></div>
<div class="input_button_outer"><div id="info_reset_<?=$rs['infoID']?>" class="input_button_style" style="width:45px;">取 消</div></div>
<div id="error_infoNontent_<?=$rs['infoID']?>" class="input_error" style="height:18px;line-height:18px;"></div>
<div class="clear"></div>
</div>
</div><div id="loading"><div>正在处理中...</div></div>
#loading{
height:20px;
border:1px solid #8ab7e9;
margin:1px 5px;
position:absolute;
bottom:0;
right:0;
z-index:100;
background:url(../upload/loading.gif) no-repeat 2px #f3f3f3;
display:none;
}
.info_reply_style{
line-height:16px;
padding:4px;
border:1px solid #594946;
margin-top:4px;
position:relative;
}
.info_reply_text{
cursor:text;
width:100%;
}
.input_button_outer{
border:1px solid #b4b4b4;
padding:1px;
float:left;
margin-left:6px;
display:inline;
height:14px;
line-height:16px;
_line-height:18px;
overflow:hidden;
}
.input_button_style{
font-size:12px;
width:90px;
height:14px;
cursor:pointer;
border:0px;
background:url(../upload/button_bg.gif) repeat-x;
text-align:center;
color:#333333;
}