个人所得税计算器

<html>
<head>
<title>个人所得税计算器</title>
<script Language="JavaScript">
<!--
function FrontPage_Form1_Validator(theForm)
{
var checkOK = "0123456789";
var checkStr = theForm.money.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("月收入中只能输入数字。");
return (false);
}

var checkOK = "0123456789";
var checkStr = theForm.KCmoney.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("起征额中只能输入数字。");
return (false);
}

//以上代码检查输入是否合法

//以下代码开始折算税后金额

var basicm,totalmoney,cha,output;
totalmoney=document.form1.money.value;
basicm=document.form1.KCmoney.value;
cha=(totalmoney-basicm);
if (cha<=0) {output=0;}
if (cha>0&&cha<=500) {output=cha*0.05;}
if (cha>500&&cha<=2000) {output=cha*0.1-25;}
if (cha>2000&&cha<=5000) {output=cha*0.15-125;}
if (cha>5000&&cha<=20000) {output=cha*0.2-375;}
if (cha>20000&&cha<=40000) {output=cha*0.25-1375;}
if (cha>40000&&cha<=60000) {output=cha*0.30-3375;}
if (cha>60000&&cha<=80000) {output=cha*0.35-6375;}
if (cha>80000&&cha<=100000) {output=cha*0.4-10375;}
if (cha>100000&&cha>100000) {output=cha*0.45-15375;}
alert("应缴个人所得税额= "+output+" 元"+"\n"+"\n"+"依法纳税是每个公民应尽的义务!!");
return (false);
}
//-->
</script>
</head>

<body>
<form name="form1" onsubmit="return FrontPage_Form1_Validator(this)">
<div align="center"><center><table border="1" width="400" cellpadding="4" cellspacing="0"
bordercolor="#bbddff" style="font-family: 宋体; font-size: 9pt">
<tr>
<td><div align="center"><center><p><span style="font-family: 宋体; font-size: 11pt"><font
color="#FF0000">个人所得税计算器</font></span></center></div></td>
</tr>
<tr align="center">
<td><span style="font-family: 宋体; font-size: 11pt">请输入您的每月所收入的金额:</span><input
name="money" type="text" size="18"><span style="font-family: 宋体; font-size: 11pt"> 元</span></td>
</tr>
<tr align="center">
<td><span style="font-family: 宋体; font-size: 11pt">请输入当地个人所得税起征额:</span><input
name="KCmoney" type="text" size="18"><span style="font-family: 宋体; font-size: 11pt"> 元</span><br>
(例如800、1000)</td>
</tr>
<tr align="center">
<td bgcolor="#88C4FF"><input type="submit" name="sub" value="计算"> <input type="reset" value="重新输入"></td>
</tr>
</table>
</center></div>
</form>
</body>
</html>

你可能感兴趣的:(JavaScript,html,J#)