PDA

View Full Version : how to swap tow array elements


yang_dx
08-13-2005, 02:04 AM
my code is:
var t = some.clones[0];
some.clones[0] = some.clones[1];
some.clones[1]=t;

it doesn't work.
i'm not quite familiar with js,and i need somebody's help.thanks!!

d~l
08-13-2005, 02:17 AM
refer to this tutorial (http://www.w3schools.com/js/js_obj_array.asp)

yang_dx
08-13-2005, 02:28 AM
thanks!!

yang_dx
08-13-2005, 02:36 AM
actually, my way works.
i use clones[i].clonenumber in my code,when i swap the clone object, i need to change clonenumber also.