Last active
October 7, 2016 04:59
-
-
Save bezborodow/8e724ffcdb0db87c92d71be6b2382205 to your computer and use it in GitHub Desktop.
Bytes Multiple Unit Calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Requires Bootstrap and jQuery. | |
--> | |
<script type="text/javascript"> | |
$(function() { | |
$('.calc-input').change(function() { | |
$('#calc-output').val(parseInt($('#calc-quantity').val()) * parseInt($('#calc-prefix').val())); | |
}).trigger('change'); | |
}); | |
</script> | |
<div class="row"> | |
<div class="col-md-4"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h3 class="panel-title">Bytes Multiple Unit Calculator</h3> | |
</div> | |
<div class="panel-body"> | |
<div class="row"> | |
<div class="col-xs-6"> | |
<div class="form-group"> | |
<input class="form-control calc-input" id="calc-quantity" value="20"> | |
</div> | |
</div> | |
<div class="col-xs-6"> | |
<div class="form-group"> | |
<select class="form-control calc-input" id="calc-prefix"> | |
<option value="1">× 1024⁰ B</option> | |
<option value="1024">× 1024¹ kiB</option> | |
<option value="1048576">× 1024² MiB</option> | |
<option value="1073741824">× 1024³ GiB</option> | |
<option value="1099511627776">× 1024⁴ TiB</option> | |
<option value="1125899906842624">× 1024⁵ PiB</option> | |
<option value="1000">× 1000¹ kB</option> | |
<option value="1000000">× 1000² MB</option> | |
<option value="1000000000">× 1000³ GB</option> | |
<option value="1000000000000">× 1000⁴ TB</option> | |
<option value="1000000000000000">× 1000⁵ PB</option> | |
</select> | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<label for="bytes-out">Result:</label> | |
<div class="input-group"> | |
<input class="form-control" id="calc-output" readonly> | |
<span class="input-group-addon">bytes (B)</span> | |
</div> | |
</div> | |
<p class="text-muted"><small>As defined by the | |
International Electrotechnical Commission and the | |
International System of Quantities.</small></p> | |
</div> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment