One-choice and multiple-choice instances are implemented based on javascript to move the instances to the right and left, and one-choice javascript operation is performed.
This example describes how to implement one-or-multiple-choice to the right and move to the left Based on javascript. Share it with you for your reference. The specific implementation method is as follows:
Method 1:
<Body>
Method 2:
<Script type = "text/javascript"> sortitems = 1; function move (fbox, tbox) {for (var I = 0; I <fbox. options. length; I ++) {if (fbox. options [I]. selected & fbox. options [I]. value! = "") {Var no = new Option (); no. value = fbox. options [I]. value; no. text = fbox. options [I]. text; tbox. options [tbox. options. length] = no; fbox. options [I]. value = ""; fbox. options [I]. text = "" ;}} BumpUp (fbox); if (sortitems) SortD (tbox);} function BumpUp (box) {for (var I = 0; I <box. options. length; I ++) {if (box. options [I]. value = "") {for (var j = I; j <box. options. length-1; j ++) {box. options [j]. value = box. options [j + 1]. value; box. options [j]. text = box. options [j + 1]. text;} var ln = I; break;} if (ln <box. options. length) {box. options. length-= 1; BumpUp (box) ;}} function SortD (box) {var temp_opts = new Array (); var temp = new Object (); for (var I = 0; I <box. options. length; I ++) {temp_opts [I] = box. options [I];} for (var x = 0; x <temp_opts.length-1; x ++) {for (var y = (x + 1); y <temp_opts.length; y ++) {if (temp_opts [x]. text> temp_opts [y]. text) {temp = temp_opts [x]. text; temp_opts [x]. text = temp_opts [y]. text; temp_opts [y]. text = temp; temp = temp_opts [x]. value; temp_opts [x]. value = temp_opts [y]. value; temp_opts [y]. value = temp ;}}for (var I = 0; I <box. options. length; I ++) {box. options [I]. value = temp_opts [I]. value; box. options [I]. text = temp_opts [I]. text ;}} </script>
I hope this article will help you design javascript programs.