SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    SitePoint Addict
    Join Date
    Apr 2004
    0 Post(s)
    0 Thread(s)

    Thumbs up autofill address problem

    I found this great script to auto fill a ship address based on the bill address

    <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;
    <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>
    see it in action here

    The problem I have come across is in using a dropdown list for the state. I am not able to autofill a select box from bill address to ship address. Can someone help me out with this on?

    Last edited by dude9er; Jul 13, 2007 at 16:29.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts