/    Sign up×
Community /Pin to ProfileBookmark

Why wont this work

trying to copy the info in housenumber to housenumber1 textbox wen i tick the checkbox.

[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<head>
<title></title>
<script type=”text/javascript”>
//<![CDATA[
<!– Hide the script from non-script-friendly browsers
//Function for copy and paste of postal address to shipping address
function copypaste(){
if (document.form1.copypastebox.checked)
{
document.getElementById(“form1”).housenumber1.value = document.getElementById(“form1″).housenumber.value;
}
}
return;

// stop hiding the script –>
//]]>
</script>
</head>

<form id=”form1″ onsubmit=”return validate_form();”>
<label>House or Unit Number: <input id=”housenumber”class=”alphanumeric”></label><br>
<label for=”shipping”>Shipping Address </label><br>
<INPUT type=”checkbox” id=”copypastebox” onclick=”copypaste()”>
<label for=”copypaste”>Tick box if Postal Address and Shipping Address are the same. </label><br>
<label>House or Unit Number: <input id=”housenumber1″ class=”alphanumeric”></label><br>
</form>[/CODE]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@samanyoluSep 22.2006 —  <br/>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;head&gt;
&lt;title&gt;&lt;/title&gt;

&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
&lt;!-- Hide the script from non-script-friendly browsers
//Function for copy and paste of postal address to shipping address
function copypaste(){

if (document.kimstar00.copypastebox.checked)
{
document.getElementById('housenumber1').value = document.getElementById('housenumber').value;
}

}


// stop hiding the script --&gt;
//]]&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;form id="form1" name="kimstar00" onsubmit="return validate_form();"&gt;
&lt;label&gt;House or Unit Number: &lt;input id="housenumber"class="alphanumeric"&gt;&lt;/label&gt;&lt;br&gt;
&lt;label for="shipping"&gt;Shipping Address &lt;/label&gt;&lt;br&gt;
&lt;INPUT type="checkbox" id="copypastebox" onclick="copypaste()"&gt;
&lt;label for="copypaste"&gt;Tick box if Postal Address and Shipping Address are the same. &lt;/label&gt;&lt;br&gt;
&lt;label&gt;House or Unit Number: &lt;input id="housenumber1" class="alphanumeric"&gt;&lt;/label&gt;&lt;br&gt;
&lt;/form&gt;


<br/>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;head&gt;
&lt;title&gt;&lt;/title&gt;

&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
&lt;!-- Hide the script from non-script-friendly browsers
//Function for copy and paste of postal address to shipping address
function copypaste(){

if (document.kimstar00.copypastebox.checked)
{
document.kimstar00.housenumber1.value = document.kimstar00.housenumber.value;
}

}


// stop hiding the script --&gt;
//]]&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;form id="form1" name="kimstar00" onsubmit="return validate_form();"&gt;
&lt;label&gt;House or Unit Number: &lt;input id="housenumber"class="alphanumeric"&gt;&lt;/label&gt;&lt;br&gt;
&lt;label for="shipping"&gt;Shipping Address &lt;/label&gt;&lt;br&gt;
&lt;INPUT type="checkbox" id="copypastebox" onclick="copypaste()"&gt;
&lt;label for="copypaste"&gt;Tick box if Postal Address and Shipping Address are the same. &lt;/label&gt;&lt;br&gt;
&lt;label&gt;House or Unit Number: &lt;input id="housenumber1" class="alphanumeric"&gt;&lt;/label&gt;&lt;br&gt;
&lt;/form&gt;




&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;head&gt;
&lt;title&gt;&lt;/title&gt;

&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
&lt;!-- Hide the script from non-script-friendly browsers
//Function for copy and paste of postal address to shipping address
function copypaste(){

if (document.kimstar00.copypastebox.checked)
{
document.kimstar00.housenumber1.value = document.kimstar00.housenumber.value;
}
if (!document.kimstar00.copypastebox.checked)
{ document.kimstar00.housenumber1.value ="" ; }
}


// stop hiding the script --&gt;
//]]&gt;
&lt;/script&gt;
&lt;/head&gt;

&lt;form id="form1" name="kimstar00" onsubmit="return validate_form();"&gt;
&lt;label&gt;House or Unit Number: &lt;input id="housenumber"class="alphanumeric"&gt;&lt;/label&gt;&lt;br&gt;
&lt;label for="shipping"&gt;Shipping Address &lt;/label&gt;&lt;br&gt;
&lt;INPUT type="checkbox" id="copypastebox" onclick="copypaste()"&gt;
&lt;label for="copypaste"&gt;Tick box if Postal Address and Shipping Address are the same. &lt;/label&gt;&lt;br&gt;
&lt;label&gt;House or Unit Number: &lt;input id="housenumber1" class="alphanumeric"&gt;&lt;/label&gt;&lt;br&gt;
&lt;/form&gt;

Copy linkTweet thisAlerts:
@kimstar00authorSep 22.2006 — thank u so much! i now kno how this works ? ? ?
Copy linkTweet thisAlerts:
@KravvitzSep 22.2006 — Did you realize that your XHTML isn't valid? [url=http://validator.w3.org/]XHTML Validator.[/url]

Did you try the code I posted in my last reply to [url=http://www.webdeveloper.com/forum/showthread.php?t=122277]your other thread that asks this question[/url]?
Copy linkTweet thisAlerts:
@kimstar00authorSep 22.2006 — Yeh i tried the code u posted in my other post.

But i couldnt get it to work.

The third code that samanyolu posted worked tho.
×

Success!

Help @kimstar00 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.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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