China Tax Calculator for Foreigners
function calculateTax() {
const income = parseFloat(document.getElementById(“income”).value);
const taxableIncome = parseFloat(document.getElementById(“taxableIncome”).value);
const deductions = parseFloat(document.getElementById(“deductions”).value);
const taxRate = parseFloat(document.getElementById(“taxRate”).value);
if (isNaN(income) || isNaN(taxableIncome) || isNaN(deductions) || isNaN(taxRate)) {
alert(“Please fill all fields correctly.”);
return;
}
const taxableAmount = taxableIncome – deductions;
const tax = taxableAmount * (taxRate / 100);
document.getElementById(“taxResult”).value = `¥ ${tax.toFixed(2)}`;
}
function resetForm() {
document.getElementById(“chinaTaxCalculatorForm”).reset();
document.getElementById(“taxResult”).value = ”;
}