Double Click in Selection Box to bring up popup

I have 2 selection boxes: 1 with a list of employees and 1 with a list of selected employees. Using arrows you can move an empoyee from the Available List to the Selected List. This works great and makes it very clear for our clients. Now I would like to add the following functionality:

I would like to create it in a way that people can double-click on the name of the employee in the Selected Employee box and that double-clicking on that name will bring up a popup with that employee's profile. I am guess something like this but just do not know how to write it in JScript:

<JAVASCRIPT>
PopUpProfile()
{
window.open("profile.asp?EMP_ID=" + document.formname.SelectedEmployee,SelectedItem.value);
}
</JAVASCRIPT>

<SELECT NAME="SelectedEmployee" OnDoubleClick="javascript:PopUpProfile()">
<OPTION VALUE="EMP_ID">Employee Name</OPTION>
</SELECT>

Is this possible and if so, how?
pgkooijmanAsked:
Who is Participating?
 
ZvonkoSystems architectCommented:
Like this:

<html>
<head>
<SCRIPT>
function PopUpProfile(theSel){
  window.open("profile.asp?EMP_ID=" + theSel.value, "profile", "top=100,left=100,height=400,width=300");
}
</SCRIPT>
</head>
<body>
<form>
<SELECT NAME="SelectedEmployee" MULTIPLE onDblClick="PopUpProfile(this)">
<OPTION VALUE="EMP_ID1">Employee Name1</OPTION>
<OPTION VALUE="EMP_ID2">Employee Name2</OPTION>
<OPTION VALUE="EMP_ID3">Employee Name3</OPTION>
</SELECT>
</form>
</body>
</html>


0
 
pgkooijmanAuthor Commented:
Hi ZVonko, I am afraid everything works but it is not getting any value for EMP_ID. theSel.value is undefined. Any way to fix that problem?
0
 
ragerinoCommented:
try this:
window.open("profile.asp?EMP_ID=" + theSel.options[thieSel.selectedIndex].value, "profile", "top=100,left=100,height=400,width=300");

normally when using the multiple attribute in select-elements you have to use a loop to check which options are selected. but you are using a doubleclick so when you first click a option it becomes selected the second time the ondblclick-event is fired.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ZvonkoSystems architectCommented:
Moin' Alex :-)

@pgkooijman: are you talking about my upper example or about yout version?
Any code can have typos, also mine ;-)

0
 
pgkooijmanAuthor Commented:
Whoopsie, my error. It works, thanks, points given!
0
 
ZvonkoSystems architectCommented:
No problem.
Thanks for points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.