View Full Version : Hiding/Displaying Combo box ?
joble
09-26-2002, 01:23 AM
Hi All,
Does anyone have tried to hide/display a combo box
using a radio button with Javascript that will work for both Netscape & IE 4.x, 5.x, 6.x etc. ?
Thank you in advance.
Best regards, joble.
adios
09-26-2002, 02:21 AM
Netscape 4x, again, the fly-in-the-ointment. Can be done but messy. Absolutely necessary?
joble
09-26-2002, 03:09 AM
Hello,
Yes, please. We still have Netscape 4.x in our computers. Can you please post the sample code
so I could try it ?
Thanks so much.
Best regards, joble.
speedracer
09-26-2002, 03:13 AM
try:
<html>
<head>
<title>hide</title>
<script language="Javascript">
<!--
var IE5up = document.getElementById && document.all;
var NS6up = document.getElementById &&! document.all;
var NS4 = document.layers;
var IE4 = document.all &&! window.print;
function hide(layerid) {
if(IE5up || NS6up)
document.getElementById(layerid).style.visibility = "hidden";
else if(NS4)
document.layers[layerid].visibility = "hidden";
else if(IE4)
document.all[layerid].style.visibility = "hidden";
}
function show(layerid) {
if(IE5up || NS6up)
document.getElementById(layerid).style.visibility = "visible";
else if(NS4)
document.layers[layerid].visibility = "visible";
else if(IE4)
document.all[layerid].style.visibility = "visible";
}
//-->
</script>
</head>
<body>
<div id="myLayer" style="position:relative;visibility:visible">
<table border="0" cellpadding="0" cellspacing="0" width="300" height="100" bgcolor="#99CCCC">
<tr>
<td valign="top">
<form name="formname">
<select>
<option>----------------------</option>
<option>----------------------</option>
</select>
</form>
</table>
</div>
<br /><br />
<a href="#" onmouseover="javascript:hide('myLayer');" onmouseout="show('myLayer')">mouse over this link to hide</a><br />
<form>
<input type="radio" name="dhtml" onclick="hide('myLayer');"><small>HIDE</small><br />
<input type="radio" name="dhtml" onclick="show('myLayer')"><small>SHOW</small><br />
</form>
</body>
</html>
joble
09-26-2002, 03:21 AM
Hello,
I've tried it and it's working !!!
Thanks a lot !!!
Best regards, joble.
adios
09-26-2002, 04:13 AM
It works fine - because the entire form is inside the Navigator Layer (inside its .document, that is). Try putting the Layer, with its hide/show Select, inside a form, with other elements you don't want hidden outside the Layer. :(
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.