I'm using PHP / MySQL / javascript (very new to javascript)

I'm looking to set the value of a textfield based on the name (NOT value) of a drop-down. The drop-down is created dynamically from a recordset (see code below):

<select name="mainStory" id="mainStory">
do {
<option value="<?php echo $row_rsMain['ID']?>"<?php if (!(strcmp($row_rsMain['ID'], $_GET['programID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsMain['mainStory']?></option>
} while ($row_rsMain = mysql_fetch_assoc($rsMain));
$rows = mysql_num_rows($rsMain);
if($rows > 0) {
mysql_data_seek($rsMain, 0);
$row_rsMain = mysql_fetch_assoc($rsMain);