Question 1.2 Create a HTML form as shown in Figure 1.1 that allow user to enter
ID: 3724928 • Letter: Q
Question
Question 1.2 Create a HTML form as shown in Figure 1.1 that allow user to enter identification Card (IC) Number in which containing the format of "dddddd-dd-ddid". Select the gender in the form is not allowed by user. Enter IC Number: Gender: Submit Male Female Figure 1.1 Prompt an alert message box when the input is incorrect format. Based on the string input, write a JavaScript to calculate the age of the user based on the current year and identify the gender of user Assume there are two images ("male.png" and "female-png"') are stored in an image folcer named "img", replace the wording in the radio button by using appropriate image. Create a tooltip to the image of gender to show a message"You're supermon for male and "You're superwomon" for female. NOTE: Use last digit in the IC Number to identify user's gender, the odd numbers for male while the even numbers denote female. (20 marksExplanation / Answer
<!DOCTYPE html>
<html>
<body>
<form>
<table>
<tr>
<td> Enter IC Number: </td>
<td> <input type="text" name="ICN" id="ICN"> </td>
</tr>
<tr>
<td>Gender:</td>
<td><input type="radio" name="gender" id="male" value="male" disabled="true"> Male
<input type="radio" name="gender" id="female" value="female" disabled="true"> Female </td>
</tr>
</table>
<input type="submit" value="Submit">
</form>
<script>
function myFunction() {
var x = document.getElementById("ICN").value;
var patt = /^d{6}-dd-d{4}$"/;
if (patt.test(x)) {
document.getElementById("male").disabled = false;
document.getElementById("female").disabled = false;
}
else {
document.getElementById("male").disabled = true;
document.getElementById("female").disabled = true;
}
}
</script>
</body>
</html>
**If you are having any issue with the code, please let me know. I shall be glad to help you with the code.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.