Pages

Tuesday, November 19, 2013

Hi, I have 2 listboxes (Items can moves between them) and i need to display the text description/title for each item when mouse over. How do i sort the description/title according to thier item after the item moved.

I have set the moved item located at the bottom of the list first. Then i will sort them after that. However i do not know how to sort the mouse over description/title according to their items.

Remind : Description/title must tie to its item.

Please help. Thanks.

function JWP_UIWT_swap(inSrc, inAll) {

if (inSrc == JWP_UIWT_LEFT) {

oSrc = document.getElementById("JWP_UIWT_swapper1_leftSelect");

oDest = document.getElementById("JWP_UIWT_swapper1_rightSelect");

} else {

oSrc = document.getElementById("JWP_UIWT_swapper1_rightSelect");

oDest = document.getElementById("JWP_UIWT_swapper1_leftSelect");

}

for (i = 0; i < oSrc.options.length; i++) {

oOpt = oSrc.options[i];

if (oOpt.selected || inAll) {

oNew = new Option(oOpt.text , oOpt.value);

oNew.title = oOpt.title;

oDest.options[oDest.options.length] = oNew;

oSrc.remove(i);

i--;

}

}

}

function sortLeftlist() {

var lb = document.getElementById('JWP_UIWT_swapper1_leftSelect');

arrTexts = new Array();

arrTitle = new Array();

for(i=0; i<lb.length; i++) {

arrTexts[i] = lb.options[i].text;

arrTitle[i] = lb.options[i].title;

}

arrTexts.sort();

for(i=0; i<lb.length; i++) {

lb.options[i].text = arrTexts[i];

lb.options[i].value = arrTexts[i];

lb.options[i].title = arrTitle[i];

}

}

-- You received this message because you are subscribed to the Google Groups "JavaScript Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.