1$(function() {2 //gets the element that is class CAName3$ (". CAName"). Click (function() {4 varTD = $ ( This);5 varTXT =Td.text ();6 varInput = $ ("<input type= ' text ' value= '" + txt + "'/>");7 td.html (input);8Input.click (function() {return false; });9 //Get FocusTenInput.trigger ("Focus"); One //The text box loses focus, commits the content, and becomes text again AInput.blur (function() { - varNewtxt = $ ( This). Val (); - //determine if the text has been modified the if(Newtxt! =txt) { - td.html (newtxt); - /* - * This section of the database does not need to be used + var caid = $.trim (Td.prev (). text ()); - //ajax Changing the database asynchronously, parameter date is the resolution of the cache problem + var url = ".. /common/handler2.ashx?caname= "+ newtxt +" &caid= "+ CAID +" &date= "+ new Date (); A //Use the Get () method to open a generic handler that data accepts the returned parameter (the method that returns the parameter in the generic handler context. Response.Write ("Parameters to return");) at //Database modification is done in a generic handler - $.get (URL, function (data) { - if (data== "1") - { - alert ("The category already exists!") "); - td.html (TXT); in return; - } to alert (data); + td.html (newtxt); - }); the */ * } $ ElsePanax Notoginseng { - td.html (newtxt); the } + }); A }); the});
Use jquery to make text boxes and modify them when you click Text