Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,464
    Thanks
    15
    Thanked 0 Times in 0 Posts

    ship to same as bill to

    i'm trying to right code that if the checkbox is checked then the bill to fields will copy the ship to fields
    so i'm using the code: document.registration.sfirstname.value=document.registration.bfirstname.value;
    document.registration.slastname.value=document.registration.blastname.value;

    this works for text boxes but country is select box -- how can I have this work to copy over the selected field by the country select box?

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Code:
    document.frm.myselectbox.options[document.frm.myselectbox.selectedIndex].value

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,464
    Thanks
    15
    Thanked 0 Times in 0 Posts
    so i did document.registration.scountry.options[document.registration.bcountry.selectedIndex].value but it doesn't work

  • #4
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Code:
    document.registration.scountry.options[document.registration.bcountry.selectedIndex].value
    It's gotta be the same object.
    You might aswell want to declare the object first to simplify your code:
    Code:
    var obj = document.registration.scountry;
    var selectedOpt = obj.options[obj.selectedIndex].value;


  •  

    Posting Permissions

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