Provide a kind of if the foreground page label is more, if the initialization of the word may be more cumbersome, this time we can be the background passed the data into a JSON string, the front desk with jquery to initialize the code to form.
functionLoadData (jsonstr) {//alert (jsonstr.tostring ()) varobj = eval ("(" + Jsonstr + ")"); varkey, value, TagName, type, arr; for(xinchobj) {Key=x; Value=Obj[x]; Try { //Alert ($ ("#ProDes"). Val ()); //Alert ($ ("[id= ' Prodes ']"). val () = "111");$ ("[id= '" + key + "']"). each (function () { //$ ("[Name= '" "+key+" '],[name= ' "+key+" [] '] "). each (function () {TagName = $ ( This) [0].tagname; Type= $( This). attr (' type '); if(TagName = = ' INPUT ') { if(Type = = ' Radio ')) { $( This). attr (' checked ', $ ( This). val () = =value); } Else if(Type = = ' checkbox ') {arr= Value.split (', '); for(vari = 0; i < arr.length; i++) { if($( This). val () = =Arr[i]) { $( This). attr (' checked ',true); Break; } } } Else { $( This). val (value); } } Else if(TagName = = ' SELECT ' | | tagName = = ' TEXTAREA ') { $( This). val (value); } Else if(TagName = = ' SPAN ') { ///If it's lable. //alert (tagName)$( This). HTML (value); } }); } Catch(e) {} }}
JQuery initializes the form