本帖最后由 sujunlin_1987 于 2010-03-13 19:57:41 编辑

解决方案 »

  1.   

    jQuery中通过ajaxStart()和ajaxStop()两个方法提供了类似的功能
      

  2.   


    $(".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;">确&nbsp;&nbsp;定</div></div>
    <div class="input_button_outer"><div id="info_reset_<?=$rs['infoID']?>" class="input_button_style" style="width:45px;">取&nbsp;&nbsp;消</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;
    }
      

  3.   

    请你相信是你的js脚本导致的图片静止的,在你处理ajax返回结果时效率太慢,js在全负荷运行时gif会卡的,通常gif在ajax请求返回前绝对不会卡的,不信你把后台方法sleep几十秒看看,优化你的中间处理代码吧,这样的问题我在写grid标签的时候遇到过,jQuery的性能还不能满足快速的大数据的复杂操作