...

View Full Version : support to disable form controls with javascript in netscape communicator 4.76



anirbang
04-30-2008, 11:43 AM
Hi,
My code to disable checkbox using onclick is not working on netscape communicator 4.76.
However it is working fine in later versions of IE & Netscape.
Is there any other way of implementing the same funtionality
without changing netscape version.(netscape 4.76 is all that I can use)
The code:
<html>
<head>
<script language=javascript>
function a(){
if (document.form1.check1.checked == true)
{document.form1.check2.setAttribute('disabled',true);}
else
{document.form1.check2.removeAttribute('disabled'); }
}
</script>
</head>
<body>
<form name=form1>
<input type="checkbox" name="check1" onClick="a();">
<input type="checkbox" name="check2" >
</form>
</body>
</html>

Kor
04-30-2008, 12:07 PM
NS4.x is an old browser, it does not support DOM 2+ methods.
Try:


if (document.form1.check1.checked == true)
{document.form1.check2.disabled=true}
else
{document.form1.check2.disabled=false}

anirbang
04-30-2008, 12:23 PM
Thanks

I also tried the method you mentioned before hand it is not working either

The code:
<html>
<head>
<script language=javascript>
function a(){
if (document.form1.check1.checked == true)
{document.form1.check2.disabled=true;}
else
{document.form1.check2.disabled=false;}
}
</script>
</head>
<body>
<form name=form1>
<input type="checkbox" name="check1" onClick="a();">
<input type="checkbox" name="check2" >
</form>
</body>
</html>

A1ien51
04-30-2008, 01:17 PM
You are still supporting a browser that is 10+ years old?

Eric

anirbang
04-30-2008, 01:34 PM
So is there no way to disable form controls in netscape communicator 4.76.
How the coders of that time used to disable form controls.
If disable method was not supported at that time.

Kor
04-30-2008, 04:05 PM
In theory should work. Unfortunately I have no Netscape 4.7 to test...

mrhoo
04-30-2008, 05:23 PM
I also can't remember if netscape 4 let you change a form element's disabled property with a script-
but I would use a pair of radio inputs in your situation, so that only one can be selected.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum