Hi,
Have a script that works fine for fieldsets, but would like
it to do the same with a DIV - at the moment there are three buttons with three hidden fieldsets - when someone clicks a radio button the style of the fieldset is set to 'inline' i would like it to do the same with hidden divs.
Have changed the fieldset to divs but didnt work - below is the working code for the fieldsets
thanks MG
javascript func
html
Have a script that works fine for fieldsets, but would like
it to do the same with a DIV - at the moment there are three buttons with three hidden fieldsets - when someone clicks a radio button the style of the fieldset is set to 'inline' i would like it to do the same with hidden divs.
Have changed the fieldset to divs but didnt work - below is the working code for the fieldsets
thanks MG
javascript func
Code:
function toggleSet(rad) {
var type = rad.value;
for(var k=0,elm;elm=rad.form.elements[k];k++)
if(elm.className=='item')
elm.style.display = elm.id==type? 'inline':'';
}
html
Code:
<style>
fieldset{display: none; padding: 10px;}
</style>
<input name="x_siteid" type="radio" value="1" checked onclick="toggleSet(this)">
<input name="x_siteid" type="radio" value="2" onclick="toggleSet(this)">
<input name="x_siteid" type="radio" value="3" onclick="toggleSet(this)">
<fieldset id="1" class="item" style="width:260px">
stuff...
</fieldset>
<fieldset id="2" class="item" style="width:260px">
stuff...
</fieldset>
<fieldset id="3" class="item" style="width:260px">
stuff...
</fieldset>