📅  最后修改于: 2023-12-03 14:59:02.097000             🧑  作者: Mango
This is a small program that converts 1 United Arab Emirates Dirham (AED) to Indian Rupees (INR) using HTML. The program takes the current exchange rate between AED and INR and multiplies it by 1 to get the equivalent amount in INR.
<!DOCTYPE html>
<html>
<head>
<title>1 AED in INR - HTML</title>
</head>
<body>
<h1>1 AED in INR</h1>
<script>
// Define the exchange rate as a constant
const exchangeRate = 19.44;
// Perform the conversion
const aed = 1;
const inr = aed * exchangeRate;
// Display the result
document.write("<p>1 AED is equivalent to " + inr.toFixed(2) + " INR</p>");
</script>
</body>
</html>
<!DOCTYPE html>
declaration, followed by the opening <html>
tag.<head>
tag, we set the title of the HTML page to "1 AED in INR - HTML".<body>
tag contains the content of the page.<h1>
tag to display the heading "1 AED in INR".<script>
tag, we write JavaScript code to perform the currency conversion.exchangeRate
.aed
to store the amount in AED (here, it's 1), and inr
to store the calculated equivalent amount in INR.document.write()
function, which writes the HTML content inside the <body>
tag.<p>
) that shows the converted value in the format "1 AED is equivalent to [converted_amount] INR", where [converted_amount]
is rounded to 2 decimal places using the toFixed()
method.The program dynamically calculates and displays the equivalent amount of 1 AED in Indian Rupees using HTML and JavaScript.