getting value from radiobutton

R

R.G. Vervoort

I would like to make a script wich makes a select visible or not visible
depending on what radio button is selected.

If the radiobutton with the value "nieuw" is selected the pulldown is not
visible and when i select the radiobutton with the value "verwijderen" the
pulldown should become visible.

The code i have makes the pull down visible but does not make it invisible
after i select another radiobutton.



This what i have so far:


<script language="JavaScript">
<!--
function Menue()
{
if (document.all.keuze.value == "nieuw")
{
document.all.naam_keuze.style.visibility="hidden"
}
else
{
document.all.naam_keuze.style.visibility="visible"
}
};

//-->
</script>
</head>

<body>
<h1>Specialisten / zorgverleners</h1>

<p align="left">
<input id="keuze" type="radio" name="keuze" value="nieuw"
onClick="Menue()">
Nieuw
<input id="keuze" type="radio" name="keuze" value="bewerken"
onClick="Menue()">
Bewerken
<input id="keuze" type="radio" name="keuze" value="verwijderen"
onClick="Menue()">
Verwijderen<img src="images/spacer.gif" width="100" height="5">
<select id="naam_keuze" size="1" name="keuze" style="visibility:visible">
<option>roy</option>
<option>jan</option>
<option>hans</option>
<option>piet</option>
</select>
</p>





thanks

roy
 
M

Morris

R.G. Vervoort said:
I would like to make a script wich makes a select visible or not visible
depending on what radio button is selected.

If the radiobutton with the value "nieuw" is selected the pulldown is not
visible and when i select the radiobutton with the value "verwijderen" the
pulldown should become visible.

The code i have makes the pull down visible but does not make it invisible
after i select another radiobutton.



This what i have so far:


<script language="JavaScript">
<!--
function Menue()
{
if (document.all.keuze.value == "nieuw")

Try this:
function Menue(selection)
{
if (selection == "nieuw")
{
document.all.naam_keuze.style.visibility="hidden"
}
else
{
document.all.naam_keuze.style.visibility="visible"
}
};

//-->
</script>
</head>

<body>
<h1>Specialisten / zorgverleners</h1>

Change also onClick="Menue()" to onClick="Menue(this.value)"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,078
Latest member
MakersCBDBlood

Latest Threads

Top