VA to kVA Calculator Using JavaScript HTML With Example

Hello Friends Today, through this tutorial, I will tell you How to Write Program VA to kVA calculator using PHP with HTML? Sure! Here’s a simple example of a VA to kVA calculator using JavaScript and HTML:

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VA to kVA Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
max-width: 400px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
}
input[type="number"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
width: 100%;
padding: 10px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h2>VA to kVA Calculator</h2>
<label for="va">Enter VA:</label>
<input type="number" id="va" placeholder="Enter VA">
<button onclick="convert()">Convert</button>
<p id="result"></p>
</div>
<script>
function convert() {
var va = parseFloat(document.getElementById('va').value);
var kva = va / 1000;
document.getElementById('result').innerHTML = va + ' VA = ' + kva + ' kVA';
}
</script>
</body>
</html>

This code creates a simple HTML page with an input field for entering the VA value and a button to trigger the conversion. When the button is clicked, the `convert()` function is called, which retrieves the input value, converts it to kVA by dividing by 1000, and displays the result.

Example:-

VA to kVA Calculator