Parameter description:
1.checkName: Indicates the name value of the check box
2.updateFile: Indicates that the database needs to manipulate the field, the project needs to update a field, so this place is the need to update the field, can be changed depending on the situation
3.formName: Represents the name value of the page form, if the program is written in the page, you can directly write the name value of the form, such as Form NAME=FORM2, you can form2.action= xxx; Form2.submit ();
But if you put the program in an external JS file, you need to get the form DOM element in the page
Note: The 1.jquery version is Jquery-1.7.2.js
2. Some programs are checked for. attr ("checked") ==true judgment, but may be a jquery version problem, not available, can be alert ((Get checkbox) when used. attr ("checked"); see what value
3. Remember that you cannot get the value in input if you set enctype= "Multipart/form-data" in the form
Http://bjsmx.taobao.com
function deletestring (checkname,updatefile,formname)
{
var deletestring= "";
var checklength=$ (": Checkbox[name=" +checkname+ "]"). Lengh;
for (Var i=0;i<checklength;i++)
{
if ($ (": Checkbox[name=" +checkname+ "]:eq (" +i+ ")"). attr ("checked") = = "Checked")
{
deletestring+=$ (": Checkbox[name=" +checkname+ "]:eq (" +i+ ")"). Val () + ",";
}
}
if (deletestring== "")
{
Alert ("No check Value");
return false;
}
Else
{
Deletestring=deletestring.substring (0,deletestring.length-1);
if (window.confirm ("OK delete") ==true)
{
$ ("form[name=" +formname+ "]") [0].action= "xxxxxxx?deletestring=" +deletestring+ "&updatefile=" +updateFile;
$ ("form[name=" +formname+ "]") [0].submit ();
}
}
}
Http://bjsmx.taobao.com