473,473 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Drag and Drop from one dropdown listbox to another

3 New Member
hi frnds,

I need ur help .im new to the javascript. i want to drag and drop an item from one dropdown listbox to an another dropdown listbox.i dont know how to do this. if possible means plz help me by giving ur suggestion
Jul 30 '08 #1
6 5882
RamananKalirajan
608 Contributor
Sorry, I cant understand your requirement. You want drag and drop or there are two list box if you click an item in the 1st list box it must goes to the second list box. Pls post back ur requirement clearly.

Regards
Ramanan Kalirajan
Jul 30 '08 #2
RamananKalirajan
608 Contributor
Just Try this and post whether this is the code you are looking for

[HTML]<html>
<head>
<script language="javascript">
function doThis()
{
var sel = document.getElementById('mySelect1').selectedIndex ;
var selObj = document.getElementById('mySelect1').options[sel].text;
document.getElementById('mySelect2').add(new Option(selObj,selObj))
}
</script>
</head>
<table>
<tr>
<td>
<select id="mySelect1" size="10" onclick="doThis()">
<option>Apple</option>
<option>Orange</option>
<option>Mango</option>
<option>Grape</option>
<option>Pine</option>
</select>
</td>
<td>
<select id="mySelect2"size="10" >
</select>
</td>
</tr>
</table>
</html>[/HTML]

Regards
Ramanan Kalirajan
Jul 30 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
i want to drag and drop an item from one dropdown listbox to an another dropdown listbox.
Is there a particular reason why you want drag/drop functionality? Can you not just use buttons instead?
Jul 30 '08 #4
Amirtha
3 New Member
Is there a particular reason why you want drag/drop functionality? Can you not just use buttons instead?
in my clge they have given a task to transfer the item from one listbox to another listbox. while working , i got an idea to use the drag and drop method. but i dono how to do tats y i asked for help. pls give me ur idea on how to do it.
Jul 30 '08 #5
Amirtha
3 New Member
in my clge they have given a task to transfer the item from one listbox to another listbox. while working , i got an idea to use the drag and drop method. but i dono how to do tats y i asked for help. pls give me ur idea on how to do it.

previously i tried this code. but this is not a good approach

[HTML]<html>
<head>
<script language="JavaScript">

function AddItem()
{
var i = document.getElementById('Combobox1').selectedIndex ;
var a = document.getElementById('Combobox1').options[i].text;
document.getElementById('Combobox2').add(new Option(a,a))
document.getElementById('Combobox1').remove(new Option(a,a))
}


</script>
</head>
<body>
<form>
<select name="Combobox1" id="Combobox1" onclick="AddItem()">
<option value="IName">Name</option>
<option value="Age">Age</option>
<option value="class">Class</option>
</select>
<select name="Combobox2" id="Combobox2">

</select> <br /><br />

</body>
</html>[/HTML]
Jul 30 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
Please use code tags when posting code. Thanks!

There's no need to make things complicated than they need to be. Just use a button to call a function to get the selected items from one list box to the other. Here's an example of what you might be looking for.
Jul 30 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: John Guarnieri | last post by:
Hi All, I need some code to drag items in a list box either up or down along with not just the text but with the itemdata too. Can anyone hook me up? TIA John
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
0
by: Yavuz Bogazci | last post by:
Hi, i have build a form with a listbox and the function that he user can drag and drop files from the windows explorer in this listbox. this works for me when i start it on my localmachine. ...
3
by: James Radke | last post by:
Hello, I was curious, is it possible to create drag and drop interface from listbox to listbox on a webform application (i.e. vb.net)? Basically the application would need to load multiple...
7
by: Sam | last post by:
Hi, I've done the method described here : http://64.78.52.104/FAQ/WinForms/FAQ_c87c.asp#q565q It works well for items added at design time. However if my source list is filled with a...
1
by: John Dalberg | last post by:
I would like to select items from a listbox into another listbox using drag and drop functionality. Does ASP.NET 2.0 webparts support this? Or any open source free framework? I am not looking for...
5
by: Ruben Gatt | last post by:
Hi, I want to do a drag and drop from one listbox to another? is it possible?? if yes any tips ?? Regards RG
1
by: SuriAug05 | last post by:
Hello, I have created one web page. In that i have used two listboxes. Now i want to drag an item from one listbox and drop the same item in another listbox. And also want to rearange the items...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.