![]() ![]() |
Nov 3 2009, 03:33 PM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 7 Joined: 13-April 09 Member No.: 30,132 |
I have a web form with 3 pairs of listboxes, 6 listboxes total. I perform exactly the same actions in a pair by pair basis so I would like to use the same function code for the 3 pairs passing 2 listboxes as parameters depending on which pair will be used.
Is it possible to indicate a function that a parameter is a listbox? Please advice. Best regards, Jorge Maldonado |
|
|
|
Nov 3 2009, 05:01 PM
Post
#2
|
|
|
The Old Man From Scene 24 ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Moderator Posts: 14,826 Joined: 17-April 06 From: Phoenix Member No.: 4,190 Languages: Focusing on PHP and JavaScript |
You can send any arguments to a function. The arguments can be scalar variables like numbers or strings, or objects or functions or whatever else you want.
|
|
|
|
Nov 3 2009, 05:20 PM
Post
#3
|
|
|
Devoted Member ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 3,319 Joined: 16-January 08 Member No.: 19,529 |
The real question for me is HOW do you want to call them? It might make a difference if you call them from an change event or from a button. The concept is simple, but the actual syntax will change. Could you describe the situation a little more? Specifically, what event/element will call this function?
|
|
|
|
Nov 3 2009, 07:26 PM
Post
#4
|
|
|
Newbie ![]() Group: Members Posts: 7 Joined: 13-April 09 Member No.: 30,132 |
The real question for me is HOW do you want to call them? It might make a difference if you call them from an change event or from a button. The concept is simple, but the actual syntax will change. Could you describe the situation a little more? Specifically, what event/element will call this function? The function shoudl be called from a button's click event. I am passing items from one listbox to the other so when I click a button then I add the selected item in the first listbox to the second listbox. Regards, Jorge Maldonado |
|
|
|
Nov 3 2009, 07:42 PM
Post
#5
|
|
|
The Old Man From Scene 24 ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Moderator Posts: 14,826 Joined: 17-April 06 From: Phoenix Member No.: 4,190 Languages: Focusing on PHP and JavaScript |
It would probably make the most sense to have a function that accepts the IDs of the two boxes, where it can look up the selected record in the first one and add it to the second one. So all the function would need are the IDs of the two boxes, and you would use document.getElementById to access each select element and figure out which record is selected.
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 23rd November 2009 - 04:49 AM |