JavaScript Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Java Script Codes
Javascript List All
Slide Show Slide Show
Ad Display Ad Display
Image Effect Image Effect
Animated Image Effects Animated Image Effects
Form Validation Form Validation
Color Picker Tool Color Picker Tool
Formatting Forms Formatting Forms
Select All Select All
Dynamic Form Select Dynamic Form select
Dynamic Color Dynamic Color
Calendar Script Calendar
Textbox Counter Textbox Counter
Alphanumeric Alphanumeric
Date Time Script Date & Time
Stop Watch Script Stop Watch script
Delete Repeated Values Delete Repeated Values
Pagination Pagination
Random Generator Random Generator
Animated Text Animated Text
Cursor Position Cursor Position
User Info Window / User Info
Security Security / Authenticate
Bookmark Bookmark
Mouse Effects Mouse Effects
Title Bar Title Bar
Status Bar Status Bar
Country List Country List
Free Games Free Games
Calculators Calculators
 




Download Time Calculator Script


About
Download time calculator script will help you to calculate the download time of file, folder or images.It Calculates time required to download large files with different modem speeds.


Features
a) This javascript function will calculate the download time of file, folder or images.
b) You have to pass file size as argument to compute() function.
c) It returns the download time based on the bandwidth.
d) Just copy the code into your page and use it.

Preview
Input File Size It will take H
If your modem is Hrs Min Sec


Code
Javascript
<!-- Script by hscripts.com -->
<style> .heading{ font-size:14px; font-family: arial, verdana, san-serif; font-weight: bold; color: black;} .subheading{ font-size:13px; font-family: arial, verdana, san-serif; color: black;} </style> <script type="text/javascript"> var speeds = new Array(new Array("9.6","9.6"),new Array("14.4","14.4"),new Array("19.2","19.2"),new Array("28.8","28.8"),new Array("33.6","33.6"),new Array("56","56"),new Array("Single Channel ISDN(64) ","64"),new Array("Dual Channel ISDN(128)","128"),new Array("ADSL(384)","384"),new Array("S-HDSL(768)","768"),new Array("CDSL(1024)","1024")); function compute(fsize, scale) { var size = parseFloat(fsize.size.value); for (var i = 1; i < 12; i++) { var time = size * scale * 8.192 / speeds[i - 1][1]; var hours = Math.floor(time / 3600); var minutes = Math.floor((time % 3600) / 60); var seconds = Math.floor(time % 60); fsize[i + "hour"].value = hours; fsize[i + "minute"].value = minutes; fsize[i + "second"].value = seconds; } } </script>
<!-- Script by hscripts.com -->


HTML Code
<form>
<table border="4">
<tr bgcolor="#D3D3D3">
<td bgcolor="#D3D3D3">
<table><tr><td class=subheading>
Input File Size
<input type="text" name="size" size="5">
<input type="button" onClick="compute(this.form, 1)" value="KB">
<input type="button" onClick="compute(this.form, 1024)" value="MB">
</td>
<td colspan=2 class=heading><center>It will take</center>
<td align=right><a href="http://www.hscripts.com" style="color:#3D366F;text-decoration:none;font-size:13px;cursor:pointer">H</a></td>
</td>
</tr>
<tr bgcolor="D3D3D3">
<th class=heading>If your modem is</th>
<th class=heading>Hrs </th>
<th class=heading>Min</th>
<th class=heading>Sec</th>
</tr>
<script type="text/javascript">
for(var j=1 ;j<12;j++)
{
document.write("<tr class=subheading><td bgcolor='#fffffe'>"+speeds[j-1][0]+" Kb</td><td><input type='text' name='"+j+"hour' size='6'> </td><td><input type='text' name='"+j+"minute' size='6'> </td><td><input type='text' name='"+j+"second' size='6'></td></tr>");
}
</script>
</table>
</td></tr>
</table>
</form>

Release Date - 07-04-2008
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com


Usage
Here we have explained with a form
a) Creating the form
<input type="text" name="size" size="5">
<input type="button" onClick="compute(this.form, 1)" value="KB">
<input type="button" onClick="compute(this.form, 1024)" value="MB">
<script type="text/javascript">
  for(var j=1 ;j<12;j++){
    document.write("<input type='text' name='"+j+"hour' size='6'>
    <input type='text' name='"+j+"minute' size='6'>
    <input type='text' name='"+j+"second' size='6'>");
   }
</script>
b) Copy the code into your page.
c) When the button 'KB' or 'MB' is clicked, the file size is passed as an argument to the 'compute()' function in download time calculator to calculate the download time.
d) Download time required to download large files with different modem speed is calculated inside 'compute' function and the value is displayed in the table.



License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.
Other Links

web hosting