[Javascript] URGENT: Object required error in onClick event

Peter Brunone peter at brunone.com
Thu Jun 20 10:06:27 CDT 2002


Michael,

	Are you sure the problem isn't a misspelled form name or the fact that
you're using integers to identify objects?

-Peter

|-----Original Message-----
|From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
|Behalf Of Michael J. Mahony
|Sent: Thursday, June 20, 2002 9:53 AM
|To: javascript at latech.edu
|Subject: [Javascript] URGENT: Object required error in onClick event
|
|
|Hi,
|
|I'm getting frustrated by this code and thought I would ask for some
|help.
|
|I've got a simple onClick handler in my code.  However, when I click the
|item I want to fire off the onClick handler I'm told that an object is
|required.  It basically just does not see the function I've designed to
|handle the onClick event.  Here is the relevant portion of the HTML
|code:
|
|<td><input type="checkbox" value="0.99-11229" name="3168"
|onClick="clicked11229();">Add Kid's Shake<i>(add
|0.99)</i></td></tr><tr><td>&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;
|<input
|type="checkbox" value="0.00-11230" name="3169">Vanilla<i>(add
|0.00)</i></td></tr><tr><td>&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;
|<input
|type="checkbox" value="0.00-11231" name="3169">Chocolate<i>(add
|0.00)</i></td></tr><tr><td>&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;
|<input
|type="checkbox" value="0.00-11232" name="3169">Strawberry<i>(add
|0.00)</i></td>
|
|
|And here is the relevant JavaScript code:
|
|<script language="javascript 1.0">
|<!--
|
|function clicked11229()
|{
|if(document.forms.orderoptions.3168.checked!=true)
|{
|alert('Got here');
|document.forms.orderoptions.3169[0].checked=false;
|document.forms.orderoptions.3169[1].checked=false;
|document.forms.orderoptions.3169[2].checked=false;
|}
|}
|
|//-->
|</script>
|
|I've also tried modifying this as follows:
|
|<script language="javascript 1.0">
|<!--
|
|function clicked11229()
|{
|if(document.orderoptions.3168.checked!=true)
|{
|alert('Got here');
|document.orderoptions.3169[0].checked=false;
|document.orderoptions.3169[1].checked=false;
|document.orderoptions.3169[2].checked=false;
|}
|}
|
|//-->
|</script>
|
|but it still fails.
|
|What am I doing wrong?
|
|Thanks!
|_______________________________________________
|Javascript mailing list
|Javascript at LaTech.edu
|https://lists.LaTech.edu/mailman/listinfo/javascript
|




More information about the Javascript mailing list