I put all together with few changes
<html>
<head>
<script lang='javascript'>
function onoff(clickedradio)
{
if (clickedradio.checked && clickedradio.value=='1')
{
document.getElementById("divtext").style.display="none";
}
else
{
document.getElementById("divtext").style.display="block";
}
}
</script>
</head>
<body>
<fieldset id="radios">
<td width="33" bgcolor="#00FF00" ><font face="Arial"><input type="radio" checked name="ItemName" onclick="onoff(this)" value="1"></font></td>
<td width="33" bgcolor="#FFFF00" ><font face="Arial"><input type="radio" name="ItemName" onclick="onoff(this)" value="2"></font></td>
<td width="33" bgcolor="#FF0000" ><font face="Arial"><input type="radio" name="ItemName" onclick="onoff(this)" value="3"></font></td>
</fieldset>
<div id=divtext style='display:none'> <font face="Arial"><textarea id="txt1" rows="8" name="ISSUE" cols="90"> </textarea></div>
</body>
</html>
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24
Easier to start getting used to Jquery.
iamthwee
Posting Genius
6,254 posts since Aug 2005
Reputation Points: 1,567
Solved Threads: 476
Skill Endorsements: 33
1)Line 3, the function must be getElementsByTagName(...)
2)It is not a good idea to create your own customize tag in HTML. If you want a field, use div tag instead.
3)You could simply use getElementsByTagName("input") and work only those with type radio and the specific name.
4)The visibility attribute won't work with JavaScript on IE8 (and maybe 7 or below). It is a bug that MS introduced. Not sure whether they have already fix it.
5)The call for input.name won't work. You need to use input.getAttribute("name") instead.
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17
Question Answered as of 7 Months Ago by
iamthwee,
Troy III,
urtrivedi
and 2 others