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
 




Bandwidth converting javascript function


About
This script function will help you to convert bandwidth to bytes from Kilobyte or Megabyte or Gigabyte


Features
a)The javascript function will return bandwidth in bytes from KB/MB/GB.
b)You have to pass two arguments bytes and type to convert from (KB or MB or GB).
c)It returns 0 on passing wrong arguments.
d)Just copy the code in to your page and use it.

Preview
Bandwith conversion from KB, MB or GB to byte value :

Enter the value and test it
[ e.g: 2 or 20 ]


Code
<!-- Script by hscripts.com -->
<script type="text/javascript">
function bandwidth(bytees,type)
{
var value = bytees;
var res;
if(!isNaN(value))
{
if(type == "KB")
  value = value*1024;
else if(type == "MB")
  value = value*[Math.pow(1024,2)];
else if(type == "GB")
  value = value*[Math.pow(1024,3)];
else
 return "error";
 
res = value+" bytes";
return res;
}
else
{
return "Error";
}
}
function tests(aaa,ty)
{
var ss = bandwidth(aaa,ty);
alert(ss);
return false;
}
</script> 
<!-- Script by hscripts.com -->

Release Date - 02-03-2005
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 using following HTML code
    <form name="test" onSubmit="return tests(test.mailf.value,test.sel.value)">
    <input name=mailf type=text>
    <select name=sel>
    <option value="KB">KB</option>
    <option value="MB">MB</option>
    <option value="GB">GB</option>
    </select>
    <input type=submit value=calculate>
    </form>
b)The javascript function tests() is triggered on submission of the form.
c)Just copy the javascript code and use it for free.




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