Posted by: prajapatinilesh | September 20, 2007

Address Auto-Fill Ckeck Box

<script type=”text/javascript” language=”javascript”>
function set_billing(box) {
var f = box.form, b_which = box.checked, from_el, to_el, i = 0;
var fld_name = new Array(‘city’ , ‘state’);
while (from_el = f[fld_name[i]]) {
to_el = f[‘bill’ fld_name[i ]];
to_el.value = b_which ? from_el.value : ”;
if (to_el.readOnly != null)
to_el.readOnly = b_which ? true : false;
else to_el.onfocus = b_which ? function() {this.blur();
}
: null;
}
}
</script>
</head>
<body>
<form>
<table>
<tr>
<td align=”right”>
<strong>Mailing Address</strong><br>
City: <input name=”city” type=”text” id=”city” onchange=”set_billing(billingaddrsame)”><br>
State: <input name=”state” type=”text” id=”state” onchange=”set_billing(billingaddrsame)”><br>
<strong>Billing Address</strong><br>
( same as above)
<input type=”checkbox” name=”billingaddrsame” onclick=”set_billing(this)”><br>
City: <input name=”billcity” type=”text” id=”billcity”><br>
State: <input name=”billstate” type=”text” id=”billstate”><br>
</td>
</tr>
</table>
</form>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: