CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Progress bar ! (http://www.codingforums.com/showthread.php?t=221677)

kentax 03-18-2011 01:54 AM

Progress bar !
 
Hello,
can this upload progress windowsbar be made to close or stop at 100%?
In the upload page the javascript code:

Code:

<script language="JavaScript">
function input(ok)
{
          var M1=ok.upload_author.value;
          if (M1=="")        {
                alert("Author is empty!"); 
                return false;
        }
          M1=ok.upload_title.value;
          if (M1=="")        {
                //alert("File Description is empty!");
                //return false;
        }
          if (ok.UploadedFile.value=="")        {
                alert("File is empty!"); 
                return false;
        }
        var sCheckType="%checktype";
        if(sCheckType=="1")
          {
                M1=ok.UploadedFile.value.toLowerCase();
                var pos=M1.lastIndexOf('.',M1.length);
                var sExt;
                if(pos>-1)
                          sExt=M1.substr(pos+1);
                var sType="%filetype";
                pos=sType.indexOf(sExt);
                if(pos>-1)
                {
                        alert("This type of file cannot be uploaded!"); 
                        return false;
                }
        }

        ok.uploadid.value=Math.round(Math.random()*100000000);
          return true;
}
function onstopupload() {
        if(document.post.uploadid.value=="") return;
        window.("uploadstop.ghp?uploadid="+document.post.uploadid.value+"&vfolder="+document.tempform.vfoldername.value) ;

}

function onshowprogress() {
        if(document.post.uploadid.value=="") return;
        window("showprogress.ghp?uploadid="+document.post.uploadid.value+"&vfolder="+document.tempform.vfoldername.value) ;

}

</script>

Then the "Show progress" button which on clik opens in a new window.

Code:

<input name="Upload" type="submit" class=button value="Upload">
                          </font>
                          <input name="stopupload" type="button" class=button id="stopupload" value="Stop" onClick="onstopupload()">
                          <input name="showprogress" type="button" class=button id="showprogress" value="Show upload progress" onClick="onshowprogress()">

And here;s the code from the Progress window.
Code:

<strong>Incarcare %filename...
<br>
%progress%
<br>
<table width="50%" border=1 align="center" cellpadding=0 cellspacing=0>
  <tr>
    <td bgcolor="#FF0000" width="%used%" height=15 style="border:0"> </td>
    <td bgcolor=white width="%left%" height=15 style="border:0"> </td>
  </tr>
</table>
<br>
<a href="showprogress.ghp?uploadid=%uploadid&vfolder=%vfolder">Actualizeaza</a>
&nbsp;
<a href="uploadstop.ghp?uploadid=%uploadid&vfolder=%vfolder">Stop</a>

Plese if anyone knows how to resolve this to pop-up in a window and when it reachis 100% to stop redirecting, or to close it self or by user.

Thanks in advance.

Cira Marius


All times are GMT +1. The time now is 08:21 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.