H I O X INDIA
FREE Javascript
Google
Web hscripts.com
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Java Script Source
List All
Date & Time
Calendar
Stop Watch script
Slide Show
Image Effect
Mouse Effects
Color Picker Tool
Dynamic Color
Random Generator
Select All
Form Validation
Textbox Counter
Dynamic Form select
Bookmark
Window / User Info
Security / Authenticate
Status Bar
Title Bar
Cursor Position
Country List
Calculators
Delete Repeated Values
Alphanumeric
Free Games





Bandwidth calculating javascript function


About
This script function will help you to calculate bandwidth in terms of Kilobyte or Megabyte or Gigabyte


Features
a)The javascript function will return bandwidth in KB/MB/GB after rounding it to six decimal places.
b)You have to pass two argumnets bytes and type to convert (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 byte value :

Enter the byte value and test it
[ e.g: 1024 or 1048576 ]
to


Code
<!-- Script by hscripts.com -->
<script language=javascript>
function bandwidth(bytees,type)
{
 var value = bytees;
 var res;
 if(!isNaN(value))
 {
  if(type == "KB")
  {
   value = Math.round((bytees/1024)*1000000)/1000000;
   res = value+" KB";
  }
  if(type == "MB")
  {
   value = Math.round((bytees/[Math.pow(1024,2)])*1000000)/1000000;
   res = value+" MB";
  }
  if(type == "GB")
  {
   value = Math.round((bytees/[Math.pow(1024,3)])*1000000)/1000000;
   res = value+" GB";
  }
  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



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 name=op value="KB">KB</option>
    <option name=op value="MB">MB</option>
    <option name=op value="GB">GB</option>
    </select>
    <input type=submit value=result>
    </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
- This javascript (misspelled as java script)/HTML code is given under GPL License
- i.e. Free use for those who use it as it is.
- Free, if your modification does not remove our copyright information and links.
- Detailed License information can be found here
- You can purchase the script if your requirements does not meet GPL License terms.


privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Others