PHP Code:--------------------------------------------------------------------------------
Script Description:
Add the following code to the <body> area:
<script language= "JavaScript" >
<!--Begin
Sortitems = 1; Automatically sort items within lists? (1 or 0)
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;
}
}
End-->
</script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.