資源描述:
《JS創(chuàng)建動(dòng)態(tài)下拉》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、JS創(chuàng)建動(dòng)態(tài)下拉1>創(chuàng)建動(dòng)態(tài)下拉*矽取URL地址欄參數(shù)*@paramparm*@returnsfunction(name){String.prototype.getQuery=varreg=newRegExp(H(A
2、&)H+name+);varr=this.substr(this.indexOf(H?n)+l).match(reg);if(r!=null)returnunescape(r[2]);returnnull};*@authorAdministrator*?deprecated創(chuàng)建一個(gè)Object*@paramobj*@
3、returnsfunctionctone(obj){if(typeof(obj)!='object'){returnobj;}if(obj==null){}returnobj;varmyNewObj=newObject();for(varkeyinobj){myNewObj[key]=clorrefobjfkey]);}returnmyNewObj;}**格式化時(shí)間數(shù)據(jù)*@paramdate*@returns{String}functiondateFormat(date){vardate=newDate();if(date!=nul
4、l){year=date.getFullYear();if((date.getMonth()+1)<10)month="0"+(date.getMonth()+1);elsemonth=date.getMonth()+1;if(date.getDate()<10)day="0"+date.getDate();elseday=date.getDate();returnyear+HJ,+month+HJ,+day;*@deprecatedAJAX請(qǐng)求*@paramurl*@paramtype*@paramparam*@paramfunc
5、functioncallAjax(url,type,param,func){varloadi;if(param!=null){$.ajax({cache:true,type:type,url:url,async:false,data:param,dataType:”jsorT,beforeSend:function(XMLHttpRequest){loadi=layer.load('數(shù)據(jù)處理中-');},complete:function(XMLHttpRequest,textstatus){layer.close(loadi},a
6、lert(H數(shù)據(jù)庫(kù)連接超時(shí)或發(fā)生錯(cuò)誤,請(qǐng)聯(lián)系管理員!”);},success:func});}else{$.ajax({cache:true,type:type,url:url,async:true,dataType:"jsorT,beforeSend:function(XMLHttpRequest){loadi=layer.load('數(shù)據(jù)處理中,);},complete:function(XMLHttpRequest,textstatus){layer.close(loadi},error:function(request){a
7、lert(”數(shù)據(jù)庫(kù)連接超時(shí)或發(fā)生錯(cuò)誤,請(qǐng)聯(lián)系管理員!”);},success:func});}};*?deprecatedAJAX異步請(qǐng)求*@paramurl*@paramtype*@paramparamtype,param,func)*@paramfuncfunctioncaHAjaxByAsyncttrrl?varloadi;if(param!=null){$.ajax({cache:true,type:type,url:url,async:true,data:param,dataType:"jsorT,loadi=layer.
8、load('數(shù)據(jù)處理中,);},complete:function(XMLHttpRequest,textstatus){layer.close(loadi},error:function(request){alert(”數(shù)據(jù)庫(kù)連接超時(shí)或發(fā)生錯(cuò)誤,請(qǐng)聯(lián)系管理員!”);},success:func});}else{$.ajax({cache:true,type:type,url:url,async:true,dataType:”jsorT,beforeSend:function(XMLHttpRequest){loadi=layer.
9、load('數(shù)據(jù)處理中,);},textstatus){layer.close(loadi},請(qǐng)聯(lián)系管error:function(request){alert(”數(shù)據(jù)庫(kù)連接超時(shí)或發(fā)生錯(cuò)誤,理員!”);},success:func})