...

View Full Version : ship to same as bill to



esthera
02-25-2007, 01:47 PM
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?

BarrMan
02-25-2007, 03:15 PM
document.frm.myselectbox.options[document.frm.myselectbox.selectedIndex].value

esthera
02-25-2007, 03:25 PM
so i did document.registration.scountry.options[document.registration.bcountry.selectedIndex].value but it doesn't work

BarrMan
02-25-2007, 03:42 PM
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:


var obj = document.registration.scountry;
var selectedOpt = obj.options[obj.selectedIndex].value;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum