...

View Full Version : Find selected order of a multiple select



rswyatt
12-19-2006, 04:29 PM
Apparently my Google skills are failing. :)

Is there a way to find in which order the selects were selected in a multiple-select select box?

For example: I select the 5th option then the 3rd then the 8th. Can JavaScript determine in which order that happened?

Thanks!
Rich

LFCFan
12-19-2006, 06:09 PM
Hello Rich,

Could you not use the select boxes onChange event to store its index numbers in a hidden textbox?

<select id = "sel1" onchange = "clickOrder()">
<option value = 1>1
<option value = 2>2
<option value = 3>3
</option>
</select>

<input type = "hidden" id = "hidden1">

<script language = "javascript">
function clickOrder()
{
var hiddenBox = document.getElementById("hidden1").value
var selValue = document.getElementById("sel1").selectedIndex

hiddenBox+=selValue
}
</script>

Not tested, but is this what you're getting at?

HTH
Joe

rswyatt
12-19-2006, 07:29 PM
<Sigh>

Always making things harder than they need to be.

Yes - this is it.

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum