I changed my code...Now everytime i click a radio button, a text box appears...What i want is when i hit a particular radio button, the textbox should only appear next to that radio button. And if another radio button is selected, then the 1st textbox should disappear and should display in front of the new radio button selected.
Following is my code:
<html>
<head>
<script type="text/javascript">
function Markit(name) {
if (name == 'a')
{
var txtInput = document.createElement("INPUT");
txtInput.type="text";
txtInput.id="txtInput"
txtInput.value=" ";
txtInput.size="30"
DivAppend.appendChild(txtInput);
}
if (name == 'b'){
var txtInput = document.createElement("INPUT");
txtInput.type="text";
txtInput.id="txtInput"
txtInput.value=" ";
txtInput.size="30"
DivAppend.appendChild(txtInput);
}
}
</script>
</head>
<bodyonLoad="appendObj();">
<div id="DivAppend">
</div>
<br />
<input onclick="Markit('a')" type="radio" name="a" value="y">Male
<br />
<input onclick="Markit('b')" type="radio" name="a" value="n">Female
<br />
</body>
</html>
Thanks