Paul a crit :
> How do I change the selected value of a dropdown list. I need to force this
> as if another part of the form changes this should change in sympathy.
> I have tried formObj.status.options[4].selected == true, but this doesn't
> work
It is at least :
document.formObj.status
with 'document' in 1st place !
and better :
document.forms['formObj'].elements['status']
where 'formObj' and 'status'
are the names of the form and of its element
ARE NOT THE ID ! ! !
Do you want : show item 5 ?
document.formObj.status.selectedIndex = 4;
or : give a new value and new text to that item ?
document.formObj.status.options[4].value = 'something.htm';
document.formObj.status.options[4].text = 'something';
or : whatelse ?
if(document.formObj.status.selectedIndex == 4)
alert(document.formObj.status.options[4].value);
--
Stephane Moriaux et son (moins) vieux Mac dj dpass