Skip to content

Instantly share code, notes, and snippets.

Created September 17, 2014 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d07e420e11567c0c5a87 to your computer and use it in GitHub Desktop.
Save anonymous/d07e420e11567c0c5a87 to your computer and use it in GitHub Desktop.
function move(element,to){
trying = element+to;
if (trying==0) {
to = count;
} else {
if (trying==count) {
to = 1;
} else {
to = trying;
}
}
fields = new Array("","name","desc","id","delete","clazz","client","");
values = new Array(fields.length);
fieldcount = fields.length -1; // I start at 1
// Save away
for(i=1;i<fieldcount;i++) {
values[i] = document.forms[0].elements[fields[i]+element].value ;
}
// Switch 1
for(i=1;i<fieldcount;i++) {
document.forms[0].elements[fields[i]+element].value = document.forms[0].elements[fields[i]+to].value;
}
// Switch 2
for(i=1;i<fieldcount;i++) {
document.forms[0].elements[fields[i]+to].value = values[i];
}
}
@tjhorner
Copy link

clazz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment