Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Buttons and show hide divs

Status
Not open for further replies.

kathyc20

Programmer
Mar 7, 2001
96
CA
Hello

I have a form that has 10 questions on it

Each question has a set of Yes/No radio buttons
and a textarea.

If the user clicks Yes, the textarea becomes visible.
If the user click No, the textarea is hidde.

My code seems to be not working the way I want.

What have I done wrong?
Thank you for any help




Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
<html xmlns=" xml:lang="en" lang="en">

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

function HideShow(obj){
var rad=obj.getElementsByTagName('INPUT');
var area=obj.getElementsByTagName('TEXTAREA')[0];
if (rad[0].checked){ area.style.visibility='visible'; }
else { area.style.visibility='hidden'; }

}
/*]]>*/
</script>
</head>

<body>
<div onclick="HideShow(this);" >
<input type="radio" name="r1" />
<input type="radio" name="r1" />
<textarea rows="2" cols="20" ></textarea>
</div>
<div onclick="HideShow(this);" >
<input type="radio" name="r2" />
<input type="radio" name="r2" />
<textarea rows="2" cols="20" ></textarea>
</div>
</body>
 
THOUGHT I WUD TRY A DIFFERENT CODE AND NOW THIS HAS ERRORS..........please anyone, help would really be appreciated.

<script language="text/JavaScript">

var i = 0;
function slideShow()
{

slidesArray = new Array()
text = new Array()



slidesArray[0]="images/poinciana.jpg"
slidesArray[1]="images/midflorida.jpg"
slidesArray[2]="images/somerset.jpg"
slidesArray[3]="images/rock springs.jpg"
slidesArray[4]="images/crystal hills.jpg"
slidesArray[5]="images/fawn meadows.jpg"
slidesArray[6]="images/apopka.jpg"
slidesArray[7]="images/sawfish.jpg"
slidesArray[8]="images/golden.jpg"


text[0]="4/2 1/2 home for sale-Kissimmee Florida"
text[1]="1/1 Loft for rent-Orlando Florida"
text[2]="4/3 home for sale-Kissimmee Florida"
text[3]="3/3 home for sale/lease-Apopka Florida"
text[4]="Triplex for sale-Lakeland Florida"
text[5]="3/2 home for sale/lease-St Cloud Florida"
text[6]="4/3 home for sale/lease-Apopka Florida"
text[7]="3/2 home for sale-Kissimmee Florida"
text[8]="3/3 home for sale-Orlando Florida"

document.images[0].scr=slidesArray
i=i+1;

if(i==9) { i=0; }
)
</script>
<p><input type=text name="description" readonly="true" style="width:230px" size=40>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top