The
jquery automatically fills the check box with the check box (true), then gets the list of check options by Ajax, and then the options in the list are played
jquery automatically fills the check box with the check box (true), then gets the list of check options by Ajax, and then the options in the list are typed. Code as follows: Dropdown box <select name= "Makemodule" id= "Makemodule" style= ' width:130px ' onchange= ' makemoduleselected ' () ' > <option value= ' 1 ' >1</option> </select> Select Change, triggering function makemoduleselected ( , this function: the following code:///////(onchange) When the template dropdown box changes. function makemoduleselected () { clearall (' property '); var modtitlecode = $ ("#makemodule"). Val (); $.ajax ({ URL: ' indexstatisticsaction_getselect.jsp ', data: {page: ' clientindexstatistics.jsp ', Method: ' Get_subname_en ',modtitlecode:modtitlecode}, success:function (Result) { //Based on result return information to determine whether login success var results = Result.split (","); //document.getelementbyid (results[i)). Checked = true; $ (". Indexstatistics "). each (function () { $ (a). Find (' input '). each (function () { var tempval = $ (this). Val (); for (var i=0 i<results.length; i++) { if (TempVal = = Results[i]) $ (this). attr ("CHecked ", True); } }); }); } }); } The function uses Ajax to Indexstatisticsaction_ Getselect.jsp makes a request, returns a string, separates the modified string into an array of strings, and then loops through the label <div class= "Indexstatistics" > The label below and encounters the associated label (TRUE). Indexstatisticsaction_getselect.jsp's code is as follows: code as follows://Get template corresponding metric if (method.equals ("Get_subname_en")) { String Modtitlecode = Request.getparameter ("Modtitlecode"); if (Modtitlecode.equals ("-------")) return; String sql = Sql2.replace ("? Modtitlecode?", modtitlecode); sql = Sql.replace ("? userId?", UserId); SYSTEM.OUT.PRINTLN (SQL); stringbuffer subnames = new StringBuffer (); db db = new db (); try { db.pr Eparequery (); ResultSet rs = db.executequery (sql); while (Rs!=null && rs.next ()) { Subnames.append (rs.getstring ("Subname_en")); subnames.append (","); } -Rs.close (); } catch ( Exception e) { e.printstacktrace (); } finally { Db.endquery (); }&nbsP PrintWriter pout = Response.getwriter (); pout.write (subnames.tostring (). substring (0,subnames.length ()-1)); Pout.flush (); pout.close (); }