CODE :-
<html>
<head>
<title>Radio Button</title>
<script type="text/javascript">
function gender()
{
var gen=document.f1.gen[0].checked;
if(gen==true)
{
document.f1.ge.value="Male";
}
else
{
document.f1.ge.value="Female";
}
return false;
}
</script>
</head>
<body>
<form name="f1" method="post" onsubmit="return gender()">
<h1>Select Gender</h1>
<input type="radio" name="gen" value="Male">Male
<input type="radio" name="gen" value="Female">Female
<input type="submit" name="submit" value="submit">
<h1>Selected Gender Is<input type="text" name="ge"></h1>
</form>
</body>
</html>
No comments:
Post a Comment