Page 1 of 1
from A to B
Posted: Sat Mar 11, 2006 12:19 am
by Dark_AngeL
Hi I need help in this
please bare with me alittle
ok say this is my window
in
A are all the item we have in the system which are entered from a different form. and say i want to chose and item from
A and move it to
B how can i do it?
Posted: Sat Mar 11, 2006 12:57 am
by feyd
This is a Javascript question. Moved to Client-side.
I know we've talked about this, but can't seem to find the thread(s) I'm thinking of..
Posted: Sat Mar 11, 2006 1:17 am
by Dark_AngeL
sorry didn't know that its a Javascript question
Posted: Sat Mar 11, 2006 2:29 am
by matthijs
The recently released Yahoo UI Library might be useful:
http://developer.yahoo.net/yui/dragdrop/index.html
Posted: Sat Mar 11, 2006 5:48 am
by Dark_AngeL
Code: Select all
<script language="JavaScript" type="text/javascript">
<!--
var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
function addOption(theSel, theText, theValue)
{
var newOpt = new Option(theText, theValue);
var selLength = theSel.length;
theSel.options[selLength] = newOpt;
}
function deleteOption(theSel, theIndex)
{
var selLength = theSel.length;
if(selLength>0)
{
theSel.options[theIndex] = null;
}
}
function moveOptions(theSelFrom, theSelTo)
{
var selLength = theSelFrom.length;
var selectedText = new Array();
var selectedValues = new Array();
var selectedCount = 0;
var i;
// Find the selected Options in reverse order
// and delete them from the 'from' Select.
for(i=selLength-1; i>=0; i--)
{
if(theSelFrom.options[i].selected)
{
selectedText[selectedCount] = theSelFrom.options[i].text;
selectedValues[selectedCount] = theSelFrom.options[i].value;
deleteOption(theSelFrom, i);
selectedCount++;
}
}
// Add the selected text/values in reverse order.
// This will add the Options to the 'to' Select
// in the same order as they were in the 'from' Select.
for(i=selectedCount-1; i>=0; i--)
{
addOption(theSelTo, selectedText[i], selectedValues[i]);
}
if(NS4) history.go(0);
}
//-->
</script>
I find this code but i need someone to explain it for me
Posted: Sun Mar 12, 2006 12:48 pm
by darryladie
What do you know about programming, do you know what a function and parameter are? *prays*
