PDA

View Full Version : DISABLING select box in Netscape? can it be done..


BrightNail
11-12-2002, 07:52 AM
hey all..

another netscape issue........

can you disable a dropdown (select box) in netscape...I can do it in IE like so....


document.doublecombo.elements["stage"+a].disabled=true;


but in Netscape, it doesn't work..I can still pull it down..

any advice.

james

glenngv
11-12-2002, 08:02 AM
disable only works in IE4+/NS6+/Mozilla but not in NS4

ahosang
11-12-2002, 04:57 PM
Try something like this:
<html>
<head>
<title></title>
<script>
function toggle() {
var s=document.forms["myform"].sel;
if (document.layers) {
s.onfocus=myBlur;
} else {
s.disabled=true;
}
}

function myBlur() {
var obj=arguments.callee.arguments[0].target;
obj.blur();
}
</script>

</head>

<body>
Test Page
<form name="myform">
<select name="sel">
<option>hello</option>
<option>world</option>
</select>
&nbsp;
<input type="button" value="disable" onclick="toggle()">
</form>

</body>
</html>