0% found this document useful (0 votes)
10 views2 pages

Calculator Web

The document is an HTML page for a Byte Converter tool that allows users to convert between bytes, kilobytes, megabytes, and gigabytes. It includes input fields for each unit and JavaScript functions to perform the conversions dynamically as the user inputs values. The tool updates the corresponding fields automatically based on the input provided.

Uploaded by

Amit Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Calculator Web

The document is an HTML page for a Byte Converter tool that allows users to convert between bytes, kilobytes, megabytes, and gigabytes. It includes input fields for each unit and JavaScript functions to perform the conversions dynamically as the user inputs values. The tool updates the corresponding fields automatically based on the input provided.

Uploaded by

Amit Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Byte Converter</title>
</head>
<body>
<h1>Byte Converter</h1>
<form>
<label for="bytes">Bytes:</label>
<input type="number" id="bytes" name="bytes" oninput="convertBytes()"
onchange="convertBytes()" value="0"><br>
<label for="kilobytes">Kilobytes:</label>
<input type="number" id="kilobytes" name="kilobytes"
oninput="convertKilobytes()" onchange="convertKilobytes()" value="0"><br>
<label for="megabytes">Megabytes:</label>
<input type="number" id="megabytes" name="megabytes"
oninput="convertMegabytes()" onchange="convertMegabytes()" value="0"><br>
<label for="gigabytes">Gigabytes:</label>
<input type="number" id="gigabytes" name="gigabytes"
oninput="convertGigabytes()" onchange="convertGigabytes()" value="0"><br>
</form>

<script>
function convertBytes() {
// Get input value
var bytes = document.getElementById("bytes").value;

// Calculate values
var kilobytes = bytes / 1024;
var megabytes = kilobytes / 1024;
var gigabytes = megabytes / 1024;

// Update other input values


document.getElementById("kilobytes").value = kilobytes;
document.getElementById("megabytes").value = megabytes;
document.getElementById("gigabytes").value = gigabytes;
}

function convertKilobytes() {
// Get input value
var kilobytes = document.getElementById("kilobytes").value;

// Calculate values
var bytes = kilobytes * 1024;
var megabytes = kilobytes / 1024;
var gigabytes = megabytes / 1024;

// Update other input values


document.getElementById("bytes").value = bytes;
document.getElementById("megabytes").value = megabytes;
document.getElementById("gigabytes").value = gigabytes;
}

function convertMegabytes() {
// Get input value
var megabytes = document.getElementById("megabytes").value;
// Calculate values
var kilobytes = megabytes * 1024;
var bytes = kilobytes * 1024;
var gigabytes = megabytes / 1024;

// Update other input values


document.getElementById("bytes").value = bytes;
document.getElementById("kilobytes").value = kilobytes;
document.getElementById("gigabytes").value = gigabytes;
}

function convertGigabytes() {
// Get input value
var gigabytes = document.getElementById("gigabytes").value;

// Calculate values
var megabytes = gigabytes * 1024;
var kilobytes = megabytes * 1024;
var bytes = kilobytes * 1024;

// Update other input values


document.getElementById("bytes").value = bytes;
document.getElementById("kilobytes").value = kilobytes;

document.getElementById("megabytes").value = megabytes;
}
</script>
</body>
</html>

You might also like