Do JavaScript: Radio Buttons


<td colspan="1" width="25%" align="left" valign="middle">
<div>   <input type="radio" name="depot_location" value="anytown, USA" tabindex="7" />   Domestic Return</div>

I want to select a Radio button on a website w/ AppleScript. Above is the source code for that radio button.

I tried doing:


do JavaScript "document.forms[0].depot_location.value = \"" & "anytown, USA\".checked=true"

but this does nothing.

Any suggestions? I’m not so good with the JavaScript (or AppleScript)

anyone? This is driving me crazy. I’ve been trying every permutation I can think of. I know it’s possible to do this in javascript, but I can’t make the “do javascript” command in Applescript with it.

Have you tried this?


do JavaScript "document.forms[0].depot_location.checked=true" in document 1

I was just about to reply back that that didn’t work, stefank when I realized my error.

This worke!!


	do JavaScript "document.forms[0].depot_location[0].checked=true" in document 1
	

I was confused because there were 4 different radio buttons to choose from and they all were named “depot_location”. I didn’t realize at first how to choose which one I wanted. Thank you!!!