Click to See Complete Forum and Search --> : Check box


shida
11-22-2002, 12:16 PM
Hi,
I have a checkbox in my form and this is the part of the code:

<INPUT type="checkbox" name="Same" value="Yes" onclick="DoCopy();">Same as Above


and this at the top of the page:

<script language="JavaScript">
function DoCopy()
{
if (document.Form1.Same.checked=true)
{
document.Form1.ShippingAddress1.value=document.Form1.Address1.value;
}
}

</script>

The problem is: when I select the check box, it takes it and does the copy function fine, but I cannot deselect the check box afterwards. Could someone please tell me where the problem is?
Thanks in advance.

gil davis
11-22-2002, 12:36 PM
Originally posted by shida
if (document.Form1.Same.checked=true)

Could someone please tell me where the problem is?
Thanks in advance.

Do you know the difference between "is equal to" (==) and "is assigned to" (=), or did you make a typo?

gil davis
11-22-2002, 07:26 PM
Thanks!

This layout seems slightly livelier somehow.