XtGem Forum catalog

javascript SELECTBOX multi--listbox

javascript SELECTBOX multi

javascript SELECTBOX multi--listbox

MAU di publish ke xtgem .com ::

<?php
// printr ($REQUEST); //ada var $GET,$POST,$COOKIE

//print
r ($POST);

print
r ($REQUEST[sel2]); //ada var $GET,$POST,$COOKIE


?>




javas-Move items between two list boxes---DOM Ajax

Pilihlah item di kiri yang dipilih ke kanan:













<!--
obj2 = document.form1.elements['myElement[7]']
obj2 = this.form.sel2
obj2 = this.form1.elements['sel2[]']

-->























<!--
function swapOpt(shift) {
elem=document.getElementById('sel2');
// elem=document.getElementById('chosen');
ind=elem.selectedIndex;
if(ind!=-1) {
if(ind==0 && shift==-1){return false;}
if(ind==elem.length-1 && shift==1){return false;}
nind=ind+shift;
tval=elem.options[nind].value;
ttxt=elem.options[nind].text;
elem.options[nind].value=elem.options[ind].value;
elem.options[nind].text=elem.options[ind].text;
elem.options[ind].value=tval;
elem.options[ind].text=ttxt;
elem.selectedIndex=nind;
selAll();
}
}




var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5); //NS4 berisi true jika navig.appname berisi kata Netscape dan dibawah versi 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--) //SEMUA index discanning
{
if(theSelFrom.options[i].selected) //JIKA dipilih oleh user
{
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); //REFRESH page to reflect changes
}

//-->

Back to posts
Comments:

Post a comment