CODE
<html>
<head><title>Example-12</title>
<script language="JavaScript">
function showData() {
var rno=parseInt(document.getElementById("txt_rno").value);
var name=document.getElementById("txt_name").value;
var male=document.getElementById("male").checked;
if(male == true)
var male1="Male";
else
male1="Female";
//alert(male1);
var read1=document.getElementById("read").checked;
var write1=document.getElementById("write").checked;
var speak1=document.getElementById("speak").checked;
//alert(read1);
if(read1 == true && write1 == true && speak1 == true) {
var a="Read, Write, Speak";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else if(read1 == true && write1 == true) {
var a="Read, Write";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else if(read1 == true && speak1 == true) {
var a="Read, Speak";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else if(write1 == true && speak1 == true) {
var a="Write, Speak";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else if(read1 == true) {
var a="Read";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else if(write1 == true) {
var a="Write";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else if(speak1 == true) {
var a="Speak";
document.write("Hello Sir/Madam, "+name+", Your registration Number: "+rno+"has been selected due to your english ability: "+a+"Your gender is: "+male1);
}
else {
alert("Please provide valid data");
}
}
</script>
</head>
<body>
<form method="POST" action="P12.html">
<table border="2px">
<tr>
<th align="center" colspan="2"><u>User Login Form:</u></th>
</tr>
<tr>
<th>Registeration Number:</th>
<td><input type="text" id="txt_rno" required/></td>
</tr>
<tr>
<th>Name:</th>
<td><input type="text" id="txt_name" required/></td>
</tr>
<tr>
<th>Gender:</th>
<td><input type="radio" name="gen" value="Male" id="male"/>Male
<input type="radio" name="gen" value="Female" id="female"/>Female</td>
</tr>
<tr>
<th>English Ability:</th>
<td><input type="checkbox" name="chk_read" value="Read" id="read" />Read
<input type="checkbox" name="chk_write" value="Write" id="write" />Write
<input type="checkbox" name="chk_speak" value="Speak" id="speak" />Speak</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="CLICK" onclick="showData()"/>
<input type="reset" value="Reset"/></td>
</tr>
</table>
</form>
</body>
</html>