This is probably OT, but anyway...

It may be the way you are referencing the form. Try
'document.forms[0].add.disabled = ( element.checked );'

That worked for me - I didn't use struts though - I just messed around with
static html:

<html>
<SCRIPT LANGUAGE="JavaScript">
function check(element) {
//alert(element.checked);
document.forms[0].add.disabled = ( element.checked );
}
</script>
<body>
<form>
<input type="checkbox" onclick="check(this)" name="myname" value="myvalue"/>
<input type="submit" name="add" />
</form>
</body>
</html>



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 25 November 2003 16:20
> To: [EMAIL PROTECTED]
> Subject: checkbox onclick event not getting called
> 
> 
> Hi,
>  
> My code is like the following, when I click the checkbox, 
> nothing happened (the 'add' button suppose to get disabled). 
> I put a alert statment in the javascript, and didn't get it 
> showed when click the checkbox... seems the function didn't 
> get called at all, can anybody tell me why? Thanks a lot!
>  
> <SCRIPT LANGUAGE="JavaScript">
> function check(element) {
> alert("getting called");
> document.myform.add.disabled = ( element.checked );
> }
> <html:form action="myAction" name="myForm">
> <html:submit propery="add" value="Add"/>
> <input type="checkbox" onclick="check(this)" name="myname" 
> value="myvalue"/>
> 
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> 


**************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not 
the addressee indicated in this message (or responsible for delivery of the message to 
such person), you may not copy or deliver this message to anyone. In such case, you 
should destroy this message, and notify us immediately. If you or your employer does 
not consent to Internet email messages of this kind, please advise us immediately. 
Opinions, conclusions and other information expressed in this message are not given or 
endorsed by my Company or employer unless otherwise indicated by an authorised 
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted 
via electronic mail attachments we cannot guarantee that attachments do not contain 
computer virus code.  You are therefore strongly advised to undertake anti virus 
checks prior to accessing the attachment to this electronic mail.  Axios Systems Ltd 
grants no warranties regarding performance use or quality of any attachment and 
undertakes no liability for loss or damage howsoever caused.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to