To the right, why do you need to select and submit to get the corresponding value. How to solve this problem-php Tutorial

Source: Internet
Author: User
To the right, why do you need to select and submit to get the corresponding value. This post was last edited by qq914260102 from 2013-10-1416: 02: 07. if you select to the right side, you cannot obtain the value. you must click it once and select it to obtain it, how can I get the default value & lt; form & nbsp; ACTION & nbsp; METHODPOST & gt; & lt; tab to the right, why do I need to select and submit to get the corresponding value.

This post was last edited by qq914260102 at 16:02:07, January 14 ,.

If the right side is selected, the value cannot be obtained. you must click it once to obtain the value. how can you get the default value on the right side?

sortitems = 1;  // Automatically sort items within lists? (1 or 0)
function move(fbox,tbox) {
for(var i=0; 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 if(box.options[i].value == "") {
for(var j=i; 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 temp_opts[i] = box.options[i];
}
for(var x=0; x for(var y=(x+1); 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[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
}
}

Share:


------ Solution --------------------
Not too easy to understand the code, just imagine
Form submission. select only submits the selected option.
Therefore, if you want to submit list2, add all the settings to the selected attribute, or assign each value of option to a new control (such as hidden) for submission.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.