/    Sign up×
Community /Pin to ProfileBookmark

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.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisNov 22.2002 — [i]Originally posted by shida [/i]

[B]if (document.Form1.Same.checked=true)



Could someone please tell me where the problem is?

Thanks in advance. [/B]
[/QUOTE]


Do you know the difference between "is equal to" (==) and "is assigned to" (=), or did you make a typo?
Copy linkTweet thisAlerts:
@gil_davisNov 23.2002 — Thanks!

This layout seems slightly livelier somehow.
×

Success!

Help @shida spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...