I want to get a javascript Program It is used to select all the options in the SELECT statement, and then place the program into the onsubmit of the form. This way, all options are automatically selected in the commit statement, which can also be received. How can I write this section of JavaScript?
Linux_boot ---------------------------------------------------------------
<Select id = A1 multiple>
<Option> 123 </option>
<Option> 456 </option>
<Option> 789 </option>
</SELECT>
<Input type = button value = change onclick = "for (I = 0; I <a1.options. length; I ++) a1.options (I). Selected = true">
---------------------------------------------------------------
Ah ~~ Right? ... You select the selected value through form
An array is submitted. You don't need to select ......
If you want to process it separately, split the array.
---------------------------------------------------------------
</Form>
<SCRIPT>
Function ifsubmit (){
VaR objsel = FRM. Select;
VaR intlen = objsel. length;
For (VAR I = 0; I <intlen; I ++)
Objsel [I]. Selected = true;
FRM. Submit ();
}
</SCRIPT>
---------------------------------------------------------------
</Form>
<SCRIPT>
Function ifsubmit (){
VaR objsel = FRM. Select;
VaR intlen = objsel. length;
For (VAR I = 0; I <intlen; I ++)
Objsel [I]. Selected = true;
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