Create a form with inputs & selections as follows: First Name: Betty [Letters on
ID: 3804339 • Letter: C
Question
Create a form with inputs & selections as follows: First Name: Betty [Letters only, first letter capitalized.] Last Name: Betters [Letters only, first letter capitalized.] Challenge: If first letter of name not capitalized, CAPITALIZE the first letter! (onblur, charAt, substr) Telephone: 123-456-7890 [length 12, digits and hyphen separator only] Zip: 12345 [length 10, digits only] 12345-7890 [length 10, digits and hyphen separator only] ? How do you reject 12345-22 ? E-Mail: type="email" SS#: 123-45-6789 [length 11, digits and hyphen separator only] Income: 0-999999 [check for number, range ] > text, password, email, tel, checkbox, radio, submit id=" " name=" " size=" " maxlength=" " title=" " placeholder=" what the user sees" pattern=" " ==>> regex quick start regex overview pattern reference! tabindex=" " required /> BirthDate: ONE Dropdown (Year): 1990-2000. Check? None select option
Please help me..I'm far behind class because of a recent child birth.
This is a Javascript Assignment.
input Validation and Tax Calculation Form First Name: Matilda Last Name: Scrunchwart zip 12345-6789 Telephone: 555-123-4567 EMail: bob@msn.com Social Security: 123-45-6789 Year of Birth 1990 Income Amount: 40000 Display tax rules in the text area. Validate Form Data & Calculate Tax Rules FirstName Matilda If income 20,000 LastName Scrunchtrart 10 of income Phone SSS-123-4S 67 If 20,000 income 60,000 SSN 123-45-6789 $2,000 and 20 of ts over $20,000 1990 YOB If 50,000 income 100, 000 Income $40,000.00 $8,000 and 2 of $50,000 If 100,000 income $6,000.00 SOO, 000 Net Income $34,000.00 $20, 500 & 30% of amount over $100,000 If S00, 000 income 14 of income You welcome Clear Form Fill Form Today is Thu Nov 06 2014. The time current time is: 10:31:27 GMT 0500 (Eastern Standard Time)Explanation / Answer
Hi,
I almost answered most of the part. It might take extra time to complete the remaining part.
Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Input Validation and Tax calculation form</h1>
<table>
<tr>
<td>First Name:<input type="text" name="" id="fn"><p id="fne"></p></td>
<td>Last Name:<input type="text" name="" id="ln"><p id="lne"></p></td>
</tr>
<tr>
<td>Telephone:<input type="number" name=""></td>
<td>Zip:<input type="number" name="" size="10"></td>
</tr>
<tr>
<td>EMail:<input type="email" name=""></td>
<td>Social Security:<input type="number" name=""></td>
</tr>
<tr>
<td>Year of birth:<select>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
</select></td>
<td>Income amount:<input type="number" name="" min="0" max="999999" id="income"></td>
</tr>
</table>
<button id="validate">Validate Form data and Calculate tax</button>
<table>
<th>
<td>Results</td>
</th>
<tr>
<td>First name:</td>
<td id="fnr"></td>
</tr>
<tr>
<td>Last name:</td>
<td id="lnr"></td>
</tr>
<tr>
<td>Income:</td>
<td id="inr"></td>
</tr>
<tr>
<td>Tax:</td>
<td id="taxr"></td>
</tr>
</table>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript">
$("#fn").on('blur',function(){
if(!($("#fn").val().charAt(0)>='A'&&$("#fn").val().charAt(0)<='Z'))
$("#fne").html("First letter should be capitalized");
});
$("#ln").on('blur',function(){
if(!($("#ln").val().charAt(0)>='A'&&$("#ln").val().charAt(0)<='Z'))
$("#lne").html("First letter should be capitalized");
});
$("#validate").on("click",function(){
var income=$("#income").val().parseInt();
var tax=0;
if(income<=20000)
tax=0.1*income;
else if(income<=50000)
tax=2000+0.2*(income-20000);
else if(income<=100000)
tax=8000+0.25*(income-50000);
else if(income<=500000)
tax=20500+0.3*(income-100000);
else
tax=0.01*income;
$("#inr").html(tax);
})
</script>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.