进度条jquery没有被执行

时间:2014-06-05 12:01:16

标签: jquery progress-bar progress

伙计们我使用这个插件来管理进度条,使用jquery& PHP https://github.com/drogus/jquery-upload-progress 这是我的JS文件: 1)jquery.js(Jquery lib 1.2.6) 2)jquery.uploadProgress.js(https://github.com/drogus/jquery-upload-progress/blob/master/jquery.uploadProgress.js) 3)另一个javascript文件,这是它的内容:

    $(document).ready(function(){

        //display new input until it exceed maximum input
        $('.file,.url').change(function(){
            var i = this.name.replace(/file|_/g,'');

            if( i >= number_of_uploads ){alert(LANG_MORE_F_FILES);return;};

            if(this.type == 'file') $('.file:eq('+ i +')').css('display', 'block');
            else $('.url:eq('+ i +')').css('display', 'block');
        });

        //display loader while upload files
        $('#uploader').submit(function(){
            $('#loadbox').css('display', 'block');
            $('#uploader').css('display', 'none');
        });
    $(".forget_pass1 a").attr('href','getpass');

    });

    //
    //javascript for captcha
    //
    function update_kleeja_captcha(captcha_file, input_id)
    {
        document.getElementById(input_id).value = '';
        //Get a reference to CAPTCHA image
        img = document.getElementById('kleeja_img_captcha'); 
         //Change the image
        img.src = captcha_file + '&' + Math.random();
    }

    //javascript for tabs
    function tabs(c1,c2,c3,c4){var m2,m3,l,t;var onclickf=function(){if(l<1)return 0;for(t=0;t<l;t++)if(m2[t]!=this){m2[t].className="";m3[t].style.display="none"}else{m2[t].className=c4;m3[t].style.display="block"}};var cl=function(){if(l<1)return 0;m2[0].className=c4;m3[0].style.display="block";for(t=0;t<l;t++)m2[t].onclick=onclickf};m2=$(c1+" "+c2+" li");if(m2[0]!="undefined"){m3=$(c1+" "+c3);l=m2.length;cl()}}$(document).ready(function(){var mah;mah=new tabs(".tabmain",".tabnav",".tabcon","tabactive")});

$(function() {
  $('form').uploadProgress({
    /* scripts locations for safari */
    jqueryPath: "jquery.js",
    uploadProgressPath: "pbar.js",
    /* function called each time bar is updated */
    uploading: function(upload) {$('#percents').html(upload.percents+'%');},
    /* selector or element that will be updated */
    progressBar: "#progressbar",
    /* progress reports url */
    progressUrl: "/progress",
    /* how often will bar be updated */
    interval: 1500
  });
});

我的HTML上传表单:

<!-- form upload -->
    <form id="uploader" name="uploader" action="{action}" method="post" enctype="multipart/form-data">

        <!-- upload boxes -->
        <div class="tabmain">

            <ul class="tabnav">
                <!-- First-Tab -->
                <li title="{lang.DOWNLOAD_F}">{lang.DOWNLOAD_F}</li>
                <!-- @First-Tab -->

                <!-- Second-Tab -->
                <IF NAME="config.www_url">
                <li title="{lang.DOWNLOAD_T}">{lang.DOWNLOAD_T}</li>
                </IF>
                <!-- @Second-Tab --> 

                <!--you-can-add-another-tab-here-->

            </ul>

            <!-- First-Box -->
            <div class="tabcon" title="{lang.DOWNLOAD_F}">
            <div class="go_up">
                <!-- upload normal -->
                <LOOP NAME=FILES_NUM_LOOP>
                <input class="file" type="file" name="file_{{i}}_" style="{{show}}" size="60" />
                </LOOP>
                <div class="agree"><span>{terms_msg}</span></div>
                <div class="bn_up"><input type="submit" id="submitr" name="submitr" value="{lang.DOWNLOAD_F}" /></div>
                <div class="clr"></div>
                <!-- @upload normal -->
            </div>
            </div>
            <!-- @First-Box -->

            <!-- Second-Box -->
            <IF NAME="config.www_url">
            <div class="tabcon" title="{lang.DOWNLOAD_T}">
            <div class="go_up">
                <!-- upload URL -->  
                <LOOP NAME=FILES_NUM_LOOP>
                <input class="url" type="text" name="file_{{i}}_" style="{{show}}" size="70" value="{lang.PAST_URL_HERE}" />
                </LOOP>
                <div class="agree"><span>{terms_msg}</span></div>
                <div class="bn_up"><input type="submit" id="submittxt" name="submittxt" value="{lang.DOWNLOAD_T}" /> </div>
                <div class="clr"></div>
                <!-- @upload URL -->  
            </div>
            </div>
            </IF>
            <!-- @Second-Box -->

            <!--you-can-add-another-box-here-->

        </div>
        <!-- @upload boxes -->


        <IF NAME="config.safe_code">
        <!-- verification code -->  
        <div class="safe_code IEs_c">
            <p>{lang.VERTY_CODE}</p>
            <div class="clr"></div>
            <div>
                <img style="vertical-align:middle;" id="kleeja_img_captcha" src="{captcha_file_path}" alt="{lang.REFRESH_CAPTCHA}" title="{lang.REFRESH_CAPTCHA}" onclick="javascript:update_kleeja_captcha('{captcha_file_path}', 'kleeja_code_answer');" />
                <input type="text" name="kleeja_code_answer" id="kleeja_code_answer" />
            </div>
            <div class="clr"></div>
            <p class="explain">{lang.NOTE_CODE}</p>
        </div>
        <div class="clr"></div>
        <!-- @end-verification-code -->
        </IF>

    </form><!-- @end-form-upload -->

    <!-- box loading -->
    <div id="loadbox">
        <div class="waitloading">{lang.WAIT_LOADING}</div>
        <div class="clr"></div><br />
            <img src="{STYLE_PATH}images/loading.gif" alt="loading ..." />
        <div class="clr">
        <div id="uploading">
        <div id="progress" class="bar">
          <div id="progressbar"></div>
          <div id="percents" style="font-weight:bold;margin:5px 0 2px 0;"></div>
        </div>
      </div>
      </div><br /><br /><br />
    </div><!-- @end-box-loading -->

但是当我尝试调用ajax时(进度条根本不起作用!!它会将我发送到index.php吗?X-Progress-ID = afc1243c4a634c42b20a2c679475a561 任何帮助PLZ家伙?

0 个答案:

没有答案