Add, delete, modify, and query in JQuery

Source: Internet
Author: User

Add, delete, modify, and query in JQuery

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head> <title> </title> <style type =" text/css "> * {margin: 0px; padding: 0px; }# menu li {width: 50px; height: 40px; margin-left: 2px; text-align: center; list-style: none; line-height: 40px; background-color: Green; float: left ;}# msg {width: 90px; height: 20px; border: solid 1px red; line-height: 20px; text-align: center ;} </style> <script type = "text/javascript"> function chekcPwd (v) {var s = v. value; s = s. ToUpperCase (); var a = 0; var B = 0; var cd = 0; // counter for (var I = 0; I <s. length; I ++) {var c = s. charCodeAt (I); if (c >=65 & c <= 90) {a = 1; // letter} else if (c >=48 & c <= 57) {B = 1; // number} else {cd = 1; // other characters} var d = document. getElementById ("msg"); if (a + B + cd = 3) {d. innerHTML = "strong ". fontcolor ("red");} else if (a + B + cd = 2) {d. innerHTML = "medium ". fontcolor ("yellow");} else {d. in NerHTML = "weak ". fontcolor ("red") ;}</script> <script type = "text/javascript"> function overImg (v) {var I = 50; var si = setInterval (function () {I + = 2; v. height = I; if (I >= 200) {clearInterval (si) ;}, 10 );} </script> <script type = "text/javascript"> function $ (id) {return document. getElementById (id);} function c (n) {return document. createElement (n);} var currentEditTr = null; // editing The row function addData () {var n = $ ("name "). value; var list = $ ("list"); var td = c ("td"); var tr = c ("tr "); var td2 = c ("td"); var delInput = c ("input"); var editInput = c ("input"); delInput. type = "button"; delInput. value = "delete"; delInput. onclick = function () {// alert (1); if (confirm ("are you sure you want to delete it? ") {List. tBodies [0]. removeChild (tr); alert (" Successful !!! ") ;}}; EditInput. type = "button"; editInput. value = "edit"; editInput. onclick = function () {$ ("name "). value = tr. childNodes [0]. innerHTML; currentEditTr = tr;}; td2.appendChild (delInput); td2.appendChild (editInput); td. innerHTML = n; tr. appendChild (td); tr. appendChild (td2); list. tBodies [0]. appendChild (tr);} function updateData () {var n = $ ("name "). value; if (currentEditTr! = Null) {// The edited item currentEditTr. childNodes [0]. innerHTML = n ;}} </script> 

 

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.