//force a decimal point to a numberfunctionToDecimal2 (x) {varf =parsefloat (x); if(IsNaN (f)) {return false; } varf = math.round (x * 100)/100; vars =f.tostring (); varrs = S.indexof ('. ')); if(Rs < 0) {RS=s.length; S+ = '. '; } while(s.length <= RS + 2) {s+ = ' 0 '; } returns;}
//query all lists and append to Div varList =data.doctorlist; varhtml = ' '; for(vari = 0; i < list.length; i++) { varImgurl =list[i].doctorimg; varDocName =List[i].doctorname; varDocdev =list[i].doctordevlement; varHosname =List[i].hospitalname; Console.log ("Picture Address" +Imgurl); Console.log ("Doctor's name" +docname); Console.log ("Department" +Docdev); Console.log ("Hospital name" +hosname); HTML+ = ' <div class= "Weui-jiaj-panel" > ' + ' <a href= "department/change_doctor_info.html" class= "weui-jiaj-a- Color "data-id=" doctorinfo "> ' + ' <div class=" Weui-media-box weui-media-box_appmsg "> ' + ' < ;d IV class= "WEUI-MEDIA-BOX__HD" > ' + ' ' + ' </div> ' + ' <div class= ' weui-media-box__bd ' > ' + ' ; } $(' #tab1 '). Append (HTML);
// Click button to get the name of each button $ ('. Depart-btn '). Click (function() { var value = $ (this). attr (' name '); // $ (this) to get the name value of the element that is currently clicked Console.log ("The name of the current button is" + value); })
//methods to get parameters in a URLfunctiongetquerystring (name) {varReg =NewRegExp (' (^|&) ' + name + ' = ([^&]*) (&|$) ', ' I '); varr = Window.location.search.substr (1). Match (REG); if(r! =NULL) { //return unescape (r[2]); Note: ECMAScript v3 has removed the unescape () function from the standard and opposes its use, so it should be replaced with decodeURI () and decodeURIComponent (). If you continue to use the Unescape function, you will get the argument garbled when getting the Chinese parameter, so the following changes returndecodeURI (r[2]); } return NULL;}//if the parameters in the URL are toutiaoforwardid and Shareshortcode//The following method is called GetQueryString gets the name//http://127.0.0.1:8020/wx/admin/department/change_doctor_info.html?toutiaoForwardId=121f1avarToutiaoforwardid = getquerystring (' Toutiaoforwardid '));varShareshortcode = getquerystring (' Shareshortcode ');
// Click the button to get the value of input and pass the URL to the next page $ ( ' #saveHospitalName '). Click (function () { var hospitalname = $ (' #hospitalName ' hospital name + Hospitalname); Window.location.href = "/wx/admin/department/change_doctor_info.html?hospitalname=" + Hospitalname; });
// bullet box, click the Save button to save the data in the box to the current page $ (' # Savedoctorname '). Click (function () { Span style= "COLOR: #0000ff" >var doctorname = $ (' #doctorName '). Val (); // input the value of $ (' #doctorNameShow '). HTML (doctorname); // Current page value save location })
// add btn dynamically in a div var doctortitellistdata = doctortitel.doctortitellist; var $titleHtml = '; for (var a = 0; a < doctortitellistdata.length; a++) { var titlename = Doctortitellistdata[a].doctortitelname; + = ' <button class= "weui-btn weui-btn_mini weui-btn_default title-btn" ' + ' name= ' + titlename + ' > ' + titleName + ' &L T;/button> '; } $ (' #doctorTitleBox '). Append ($titleHtml);
Common jquery Methods