Forum Moderators: open
I got a question regarding layers.
Let's say I got this:
<input type=radio name=test value=1 checked=1>1<input type=radio name=test value=0>2
2 buttons, one is called 1 and the other is called two.
When I push 1, I want "<SELECT NAME=LeFreq SIZE=6>" To dissapear.
Imagine a Disable/enable switch the disables/enables lights in your room.
How in the world do I do that? - I read something about layers and css, but I didn't understand much of it I'm afraid.
Would anyone be interested in perhaps elaborating it a bit further?
Nice page you got here by the way, registered today but often got very good hints and tips from here :)
Hope this helps.
<html>
<head>
</head>
<body>
<form name="form1">
<input type=radio name=test value=1 checked onclick="disableHobbies()">1
<input type=radio name=test value=2 onclick="disableHobbies()">2
<select name="hobbies" style="display:none">
<option value="hob1">Hobbies 1
<option value="hob2">Hobbies 2
<option value="hob3">Hobbies 3
</select>
</form>
</body>
</html>
<script>
function disableHobbies() {
var testval=document.getElementById("test");
for(var i=0;i<testval.length;i++) {
var hobbiesval=testval(i).value;
if(hobbiesval==1) {
alert("came here");
document.getELementById("hobbies").display="block";
}
}
}
</script>
Thanks
Prasanth J.V.R.S
Sorry please look into this code...
<html>
<head>
</head>
<body>
<form name="form1">
<input type=radio name=test value=1 onclick="disableHobbies()">1
<input type=radio name=test value=2 checked onclick="disableHobbies()">2
<select id="hobbies" name="hobbies" style="display:none">
<option value="hob1">Hobbies 1
<option value="hob2">Hobbies 2
<option value="hob3">Hobbies 3
</select>
</form>
</body>
</html>
<script>
function disableHobbies() {
var testval=document.forms[0].test;
for(var i=0;i<testval.length;i++) {
var hobbiesval=testval[i].value;
if(testval[0].checked) {
document.getElementById("hobbies").style.display="block";
}
else {
document.getElementById("hobbies").style.display="none";
}
}
}
</script>
Thanks
Prasanth J.V.R.S
I added a script in the header:
<head>
<script>
function ToggleVisibility(el)
{
if( document.getElementById(el).style.visibility!= 'hidden' )
document.getElementById(el).style.visibility = 'hidden';
else
document.getElementById(el).style.visibility = 'visible';
}
function HideVisibility(el)
{
document.getElementById(el).style.visibility = 'hidden';
}
function ShowVisibility(el)
{
document.getElementById(el).style.visibility = 'visible';
}
</script>
</head>
Then I did:
<% If Request.QueryString("Leakdet0") = "0" Then %>
<td><b><INPUT onclick=HideVisibility('LeakageOptions') TYPE=RADIO NAME=LeakDet0 VALUE=0 checked>Disabled <INPUT onclick=ShowVisibility('LeakageOptions') TYPE=RADIO NAME=Leakdet0 VALUE=1>Enabled </b></td></tr>
<% Else %>
<td><b><INPUT onclick=HideVisibility('LeakageOptions') TYPE=RADIO NAME=LeakDet0 VALUE=0>Disabled <INPUT onclick=ShowVisibility('LeakageOptions') TYPE=RADIO NAME=Leakdet0 VALUE=1 checked>Enabled </b></td></tr>
<% End If %>
Where <div id='leakageoptions'> pointed to a table which had the options for disable enable. And it worked out great :)