Using applescript to affect drop down menus.

Is there a way in IE to be able to set the dropdown menu using the JS feature.

textfields i know, thanks to jj, but my form i need to fill in uses drop down menus also.

Cheers guys.

Is it similar to this

window.document.forms[0].elements[0].choice=‘0’

???

"document.forms[0].elements[0].selectedIndex = 0;"

Which means: first form, first element (suppossed to be a popup menu), selected item = first one.

it doesnt work jj, have tried the following:


do script "window.document.forms[0].elements[6].selectedIndex=L;"
do script "window.document.forms[0].elements[6].selectedIndex='L'"
do script "document.forms[0].elements[6].selectedIndex=L;"

still no luck. Could all these problems stem from the form, and if so what would have to be changed.

do you have any other ideas as to why this is happening.

Also i am using IE 5.2 on mac osX as far as i know.

This code will evaluate a select-one element (modify the form and element indexes accordingly) and if the supplied element’s value or label matches either of the values supplied for element_label_val or element_val then that option will be selected:

Jon

have tried the code but am confused as to what the label and value fields do.

Is it the value in the drop down???

Sorry for not being clearer. In my code, I’m assuming you know the form number and element number for the select (drop down menu) and you know the value or the label of the item you want, but not it’s index in the option list. This code goes through all the options in the select field and if either the value of the indexed item or the label associated with it matches either of the two values you supplied, the proper item will be selected in the form. As an example, say there was a select that asked for your title (e.g., Mr., Ms. Mrs., Dr., etc.). I want to enter “Mr.” The select has a label that equals “Mr.” but the value for the entry is unknown (it may be 1, or “mr”, or “mon,” whatever). By setting element_label_val to “Mr.” no matter what the values are, the right selection will be made based on the label or vice versa based on the value with an unknown label. Did that help or did I make the water more muddy?

Jon

yeah i think so!!

Buti will let you know my result when i try it.

Cheers

yeah i think so!!

Buti will let you know my result when i try it.

Cheers