Refreshing and prompting users to choose to delete one of them randomly
Source: Internet
Author: User
A problem encountered during development recently is that the customer requires no more options, but these projects can only select 2 items at most. If you select more than 2 items, you are prompted to choose to delete one of them randomly. I found a lot on the Internet Article No instance is found. Therefore, I have worked hard to write a new one and share it with you. I'm a cainiao! Hope experts can give more valuable comments
In fact, the first step is checkboxlisttext. aspx.
<Head>
<Title> checkboxlist instance </title>
</Head>
<Script language = "JavaScript">
Function setcheckboxstate (STR)
{
O = Document. getelementsbytagname ("input ")
// O = from1.cbyyjslscly;
Var val = 0;
For (I = 0; I <O. length; I ++)
{
If (O [I]. type = "checkbox" & O [I]. Checked & O [I]. Name = Str)
{
// Alert (O [I]. value)
Val = Val + 1;
}
If (Val> 2)
{
Alert ('the project you selected can only be within two! ')
O [I]. Checked = false;
Return;
}
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