var tracywindyObject = {}; var isEnableTracywindyRandomUrl = false; function getTracywindyRandomUrl(url){ var tempUrl; if(!isEnableTracywindyRandomUrl){ tempUrl = "tracywindyRandom=1"; }else{ tempUrl = "tracywindyRandom=" + Math.random(); } /* * ��ԴURL ��ӱ�־�� */ if(url.indexOf('?')>-1){ url += ("&" + tempUrl); }else { url += ("?" + tempUrl); } return url; } //��ʽ������Ϊǧ��λ function formatNumberThousand(s) { if(isNaN(s)){ return s; } s += ""; s = s.replace(/,/g,""); var re=/(\d{1,3})(?=(\d{3})+(?:$|\D))/g; //Фң��ָ�� var n1=s.replace(re,"$1,"); return n1; } //�ж�parentObj�Ƿ���obj���ϼ�Ԫ�� function isParent(obj,parentObj){ while (obj != undefined && obj != null && obj.tagName.toUpperCase() != 'BODY'){ if (obj == parentObj){ return true; } obj = obj.parentNode; } return false; } function clearForm(form) { var elements = form.elements; for(var i=0;i -1, //IE�ں� presto : userAgent.indexOf('presto') > -1, //opera�ں� webKit : userAgent.indexOf('applewebkit') > -1, //ƻ�����ȸ��ں� gecko : userAgent.indexOf('gecko') > -1 && userAgent.indexOf('khtml') == -1, //����ں� mobile : !!userAgent.match(/applewebkit.*mobile.*/)|| !!userAgent.match(/applewebkit/), //�Ƿ�Ϊ�ƶ��ն� ios : !!userAgent.match(/\(i[^;]+;( u;)? cpu.+mac os x/), //ios�ն� android : userAgent.indexOf('android') > -1 || userAgent.indexOf('linux') > -1, //android�ն˻���uc����� iPhone : userAgent.indexOf('iphone') > -1 /*|| userAgent.indexOf('mac') > -1*/, //�Ƿ�ΪiPhone����QQHD����� iPad: userAgent.indexOf('ipad') > -1, //�Ƿ�iPad webApp : userAgent.indexOf('safari') == -1,//�Ƿ�webӦ�ó���û��ͷ����ײ� google:userAgent.indexOf('chrome')>-1, getBrowser:function(){ if(SysBrowser.msie) return "IE"; else if(SysBrowser.firefox) return "Firefox"; else if(SysBrowser.chrome) return "Chrome"; else if(SysBrowser.opera) return "Opera"; else if(SysBrowser.safari) return "Safari"; else return "IE"; }, getVersion:function(){ return SysBrowser.version; }, getLanguage:function(){ return SysBrowser.language; } }; function getEvent(e) { return window.event||e; } function getTarget(e) { var e = getEvent(e); return e.srcElement||e.target||e.currentTarget; } function cancelBubble(e) { var e = getEvent(e); try{ e.cancelBubble = true; e.stopPropagation(); }catch(e){ e.cancelBubble = true; } } function stopDefault(e){ try { getEvent(e).returnValue=false; getEvent(e).preventDefault(); getEvent(e).stopPropagation(); }catch(e) { getEvent(e).returnValue=false; } } //ǿ�Ƽ�n��С��30->30.00 function forcePreciseDecimal(x,scale) { scale = scale||2; var f_x = parseFloat(x); if (isNaN(f_x)) { alert('function:forcePreciseDecimal->parameter error'); return false; } var f_x = Math.round(x*100)/100; var s_x = f_x.toString(); var pos_decimal = s_x.indexOf('.'); if (pos_decimal < 0) { pos_decimal = s_x.length; s_x += '.'; } while (s_x.length <= pos_decimal + scale) { s_x += '0'; } return s_x; } function decimalReal(num,v) { var dight =(num*Math.pow(10,v)/Math.pow(10,v)).toFixed(v); return parseFloat(dight); } //�������� function decimal(num,v) { //num��ʾҪ�����������,v��ʾҪ������С��λ���� if(0 == v) { return decimalReal(decimalReal(num,2),0); } return decimalReal(num,v); } function getTracywindyObject(id) { return tracywindyObject[id]; } //function ����css String.prototype.trim=function(){ return this.replace(/(^\s{1,})|(\s{1,}$)/gim,""); }; Array.prototype.contains = function(item){ for(i=0;i=48)&&(keyCode<=57))||(keyCode==8)||(keyCode==190)) { pass = true; } //С���� if(((keyCode>=96)&&(keyCode<=105))||(keyCode==110)) { pass = true; } e.returnValue = pass;*/ } //����һ��ȫ������ function openFullScreenWindow(strURL,attachmentParams,winRef) { if(-1==strURL.indexOf("systemMathRandom")) { if(strURL.indexOf("?")>-1) { strURL+="&systemMathRandom=systemMathRandom"; } else { strURL+="?systemMathRandom=systemMathRandom"; } } if(attachmentParams) { if('string' == typeof(attachmentParams)) { strURL += ("&"+attachmentParams.replace(/(^&)|(^\?)/,"")); } else if('object' == typeof(attachmentParams)) { for(var p in attachmentParams) { strURL+=("&"+p+"="+attachmentParams[p]); } } } /*strURL=encodeURI(encodeURI(strURL)); var params = {}; if(attachmentParams){ if("object" == typeof(attachmentParams)){ for(var p in attachmentParams){ params[p] = attachmentParams[p];//escape(encodeURIComponent(attachmentParams[p])); } } else if("string" == typeof(attachmentParams)){ var paramsArr = attachmentParams.split("&"); for(var i=0;i=1){ key = keyValueArr[0]; if(key){ key = key.trim(); } } if(keyValueArrLen>=2){ value = keyValueArr[1]; if(value){ value = value;//escape(encodeURIComponent(value)).trim(); } } if(key){ params[key]=value; } } } } }*/ var sheight = window.screen.availHeight-30; var swidth = window.screen.availWidth-10; var winoption ="left=0px,top=0px,height="+sheight+"px,width="+swidth+"px,toolbar=yes,menubar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes"; if(winRef){ window.loc = function(){ winRef.location.href = strURL;//�ı�ҳ��� location }; setTimeout("window.loc();",800);//����ȴ�����Ҫ��������ȴ��Ļ����޷�ʵ�� }else{ window.open(strURL,'_blank',winoption); } /*var tempSubmitForm = document.getElementById("id_tempSubmitForm"); if(!tempSubmitForm){ tempSubmitForm = document.createElement("form"); document.body.appendChild(tempSubmitForm); } with(tempSubmitForm){ style.display="none"; innerHTML = ""; action = strURL; target = "temSubmitFormTargetWindow"; method = "post"; } for(p in params){ var hiddenInput = document.createElement("input"); with(hiddenInput){ type = "hidden"; name = p; value = params[p]; } tempSubmitForm.appendChild(hiddenInput); } tempSubmitForm.submit();*/ return false; } function setCookie(name,value)//����������һ����cookie�����ӣ�һ����ֵ { var Days = 30; //�� cookie �������� 30 �� var exp = new Date(); //new Date("December 31, 9998"); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); } function getCookie(name)//ȡcookies���� { var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) return unescape(arr[2]); return ""; } //ɾ�����ֶ����0 function nullToString(value) { if((typeof(value)=='undefined')||(value==null)) { return ""; } return value; } function trimZero(numberStr) { if(!numberStr) return numberStr; var floatValue = parseFloat(numberStr); var intVar = parseInt(numberStr); var resultStr = ""; if(intVar==floatValue) { resultStr= intVar+""; } else { resultStr=(floatValue+"").replace(/(^0+)|(0+$)/gi,""); } return resultStr; } function empty2Other(sourceStr,replaceStr) { return !sourceStr ? replaceStr : sourceStr; } //˵��������ij��table�е������Ϊֻ��/�ɱ༭ //����1������table��ID //����2:table�Ǹ����Dz��������ԡ�,���ָ� //����3:�������� 0Ϊֻ�� 1Ϊ�༭ function formJSPInputHideOrShow(id,exceptFfield,stype){ if(document.getElementById(id)){ var inputs=jQuery("#"+id+" input[type='text'],#"+id+" textarea"); var d=0; var vfield=[]; var cflag=true; if(exceptFfield!=""){vfield=exceptFfield.split(",");} for(;d0){ for(var i=0;i0){ //inputs[d].setAttribute("onClick","WdatePicker(inputs[d],{readOnly:true})"); inputs[d].onclick=""; removeClass( inputs[d],"Wdate"); } } else{ inputs[d].readOnly = false; var pnode=inputs[d].parentNode; removeClass( inputs[d],"element-readonly"); if(inputs[d].getAttribute("dataType")=="Date"){ inputs[d].readOnly = true; inputs[d].onclick=function(){WdatePicker(this,{readOnly:true})}; inputs[d].className=inputs[d].className+" Wdate "; } } }} } } //��ѯ���пؼ��б����� function checkTracywindyTableData(talbeid,title){ var sourceTable= getTracywindyObject(talbeid); var sourceData=sourceTable.getRowsJsonData(); if(sourceData.length<=0){ jQuery.messager.alert('��ʾ',"
����д"+title+"
",'error'); return false; } var sourceColumn=sourceTable.columns; var columndata; var onecolumn; for(var i=0;i