Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1290 How can I hide a list box if one radio button is selected and show it if the other gets selected?

You are here: irt.org | FAQ | JavaScript | Form | Q1290 [ previous next ]

Try:

<style type="text/css"><!--
.hidden { position: absolute; visibility: visible; }
//--></style>

<script type="text/javascript" language="JavaScript"><!--
function set(What,Value) {
alert(What + '\n' + Value);
    if (document.layers && document.layers[What] != null) document.layers[What].visibility = Value;
    else if (document.all) eval('document.all.'+What+'.style.visibility ="'+ Value+'"');
}

function clicked(Form,Radio,Layer) {
    for (var i=0; i<Form[Radio].length; i++) {
        if (Form[Radio][i].checked) set(Layer,Form[Radio][i].value);
    }
}
//--></script>


<form>
<input type="radio" name="button1" value="visible" onClick="clicked(this.form,this.name,'myLayer')" checked>
<input type="radio" name="button1" value="hidden" onClick="clicked(this.form,this.name,'myLayer')">
</form>

<div id="myLayer" class="hidden">
<form>
<select>
<option value="one">one
<option value="two">two
<option value="three">three
</select>
</form>
</div>

Feedback on 'Q1290 How can I hide a list box if one radio button is selected and show it if the other gets selected?'

©2018 Martin Webb