Top.Mail.Ru
? ?
Javascript's Journal
 
[Most Recent Entries] [Calendar View] [Friends View]

Tuesday, July 12th, 2005

Time Event
8:16p
multiple select box problem
I have a multiple select box problem.

<select size="5" name="relatedFiles[]" multiple>
   <option value="0">0
   <option value="1">1
   <option value="2">2
   <option value="3">3
   <option value="4">4
</select>


Is there a way to use javascript to select one or more of the options? That is, to hightlight them as if the user clicked on them with the mouse.

The name of the box has to have a [] on the end, since I'm passing this to PHP, and it's gotta be named like an array in order to pass all of the information (which options the user has selected.)

document.addPost.relatedFiles[0].options[0].selected doesn't work, neither does document.addPost.relatedFiles.options[0].selected.

<< Previous Day 2005/07/12
[Calendar]
Next Day >>
About LiveJournal.com
Image