Delete row TR in JS to hide the table

Source: Internet
Author: User

 <MCE: Script Type = "text/JavaScript"> <! -- <Br/> var countnum = <% = countnum1 %>; <br/> function del () <br/>{</P> <p> If (parseint (document. getelementbyid ("hidcount "). value)> 0) <br/>{< br/> var checkedcount = 0; // record the number of rows of the selected record <br/> var checkedid = ""; // record the ID of the selected row <br/> var chcekedcountid = ""; // record the row number of the selected row <br/> var countnum = document. getelementbyid ("hidcount "). value; // The original row number <br/> for (VAR I = 1; I <= parseint (document. getelementbyid ("hidcount "). value); I ++) <br />{< Br/> If (document. getelementbyid ("Chk" + I ). checked = true) <br/>{< br/> checkedcount ++; <br/> If (checkedid = "") <br/>{< br/> checkedid = document. getelementbyid ("Chk" + I ). value; <br/>}< br/> else <br/>{< br/> checkedid = checkedid + "," + document. getelementbyid ("Chk" + I ). value; <br/>}< br/> If (chcekedcountid = "") <br/>{< br/> chcekedcountid = I; <br/>}< br/> else <br/> {<br/> chcekedcountid = C Hcekedcountid + "," + I; <br/>}< br/> If (checkedcount> 0) <br/>{< br/> If (confirm ("are you sure you want to delete the record? ") <Br/>{</P> <p> // run the delete operation, after the deletion is successful, the deleted row is hidden. </P> <p> var rtnval = mms_sendrecordlist.delid (checkedid ). value; </P> <p> If (rtnval = "1 ") <br/> {<br/> // hide the row <br/> var AA = chcekedcountid + ","; // solve the chcekedcountid error reported by only one id js (split) <br/> var deltr = AA. split (","); <br/> for (var j = 0; j <deltr. length-1; j ++) <br/>{< br/> document. getelementbyid ("TR" + deltr [J]). style. display = "NONE"; <br/>}< br/> checkedcount = 0; <br/> checke Did = ""; <br/> chcekedcountid = ""; <br/> document. getelementbyid ("hidcount "). value = parseint (document. getelementbyid ("hidcount "). value)-checkedcount; // re-calculate the row <br/> // clear the selected <br/> for (VAR I = 1; I <= parseint (countnum ); I ++) <br/>{< br/> If (document. getelementbyid ("Chk" + I ). checked = true) <br/>{< br/> document. getelementbyid ("Chk" + I ). checked = false; <br/>}</P> <p >}< br/> else <br/>{< br/> Che Ckedid = ""; <br/> return; <br/>}< br/> else <br/> {<br/> alert ("select the row you want to delete! "); <Br/>}< br/> else <br/>{< br/> alert (" no data is available for deletion! "); <Br/> return; <br/>}</P> <p> <a href =" http://www.51.la /? 3103169 "mce_href =" http://www.51.la /? 3103169 "target =" _ blank "> </a>

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.