?
Path : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/includes/ |
Current File : /home/admin/domains/happytokorea.com/public_html_bk/backoffice/includes/function.js |
<!-- var ie4=document.all; var dom=document.getElementById; //----------------------[select_all]---------------------- function selall(all,v){ if(v.checked){ // เลือกทั้งหมด parent.arr_data.length=0; if(all==1){ document.all.chkboxid.checked="on"; parent.arr_data[0]=parent.arr_selall[0]; }else{ for (var i=0;i<all;i++){ document.all.chkboxid[i].checked='on'; parent.arr_data[i]=parent.arr_selall[i]; } } } else{ // เคลียร์ทั้งหมด if(all==1){ document.all.chkboxid.checked=""; parent.arr_data.length=0; }else{ for (var i=0;i<all;i++){ document.all.chkboxid[i].checked=''; parent.arr_data.length=0; } } } //alert(parent.arr_selall.length); //alert(parent.arr_data.length); } //----------------------[select_all]---------------------- //----------------------[select_item]---------------------- function select_item(a,value){ size=parent.arr_data.length; if(value.checked){ chkaddar='F'; for (var i=0;i<size;i++){ if(parent.arr_data[i]==a){ chkaddar='T'; //alert(parent.arr_data[i]+' '+a+' '+chkaddar); break; }else{ chkaddar='F'; } }//for if(chkaddar=='T'){;} else{ for (var i=parent.arr_data.length+1; i>size; i--) parent.arr_data[i] = parent.arr_data[i-1]; parent.arr_data[size] = a; parent.arr_data.length = parent.arr_data.length-1; }//if else }else{ document.all.chk_all.checked=""; //เอาเครื่องหมายถูกออกจาก select all for (var i=0;i<=size;i++){if (parent.arr_data[i]==a){ delindex=i;i=size;}} // หา Index ที่เราจะลบข้อมูล โดยนำค่าที่เราจะลบไปเทียบกับข้อมูลในตัวแปร Array for (var j=delindex; j<size-1; j++) if (j != size) parent.arr_data[j] = parent.arr_data[j+1]; parent.arr_data.length = size-1; }//if else value.checked /* arr_text=""; for(i=0;i<parent.arr_data.length;i++){ arr_text+=parent.arr_data[i]+"="; } alert(arr_text); */ //alert(parent.arr_data.length); }//function //----------------------[select_item]---------------------- function checkcurrency(event){ var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if ((keyCode >47 && keyCode < 58) ||keyCode==46) { return true; } else if (keyCode == 13){ return true;} else{ alert("Number or Decimal..."); return false; } } function checknumberic(event){ var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode >47 && keyCode < 58) { return true; } else if (keyCode == 13){ return true;} else{ alert("ใสตัวเลขอย่างเดียว (0-9)..."); return false; } } function handleEnter(field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for( i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } function emailCheck (emailStr) { var emailPat=/^(.+)@(.+)$/ var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" var validChars="\[^\\s" + specialChars + "\]" var quotedUser="(\"[^\"]*\")" var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/ var atom=validChars + '+' var word="(" + atom + "|" + quotedUser + ")" var userPat=new RegExp("^" + word + "(\\." + word + ")*$") var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$") var matchArray=emailStr.match(emailPat) if (matchArray==null) { alert("Email address seems incorrect (check @ and .'s)") return false } var user=matchArray[1] var domain=matchArray[2] if (user.match(userPat)==null) { alert("The username doesn't seem to be valid.") return false } var IPArray=domain.match(ipDomainPat) if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("Destination IP address is invalid!") return false } } return true } var domainArray=domain.match(domainPat) if (domainArray==null) { alert("The domain name doesn't seem to be valid.") return false } var atomPat=new RegExp(atom,"g") var domArr=domain.match(atomPat) var len=domArr.length if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) { alert("The address must end in a three-letter domain, or two letter country.") return false } if (len<2) { var errStr="This address is missing a hostname!" alert(errStr) return false } return true; } function enterField(f1) { if (f1 && f1.style) { f1.style.background='#FEFDE0'; } } function exitField(f1) { if (f1 && f1.style) { f1.style.background='#FFFFFF' } } //-----------------------------[List]------------------------------- function bgc(value,color){ if(value.style.background=="#3399ff"){value.style.background=color; }else{value.style.background="#3399FF";} } function bgcover(value,color){ if(value.style.background=="#3399ff"){value.style.background="#3399ff"; }else{value.style.background="#00CCFF";} } function bgcout(value,color){ if(value.style.background=="#3399ff"){value.style.background="#3399ff"; }else{value.style.background=color;} } //-----------------------------[List]------------------------------- function open_pop(w,h,fileto){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2-30 : 0; var now = new Date(); var hour = now.getHours(); var minute = now.getMinutes(); var second = now.getSeconds(); var op=window.open(fileto+"",hour+minute+second,"left="+LeftPosition+",top="+TopPosition+",toolbar=0,width="+w+",height="+h+",directories=no,menubar=no,resizable=0,scrollbars=no"); op.focus(); } function f_open(w,h,fileto){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; alert(screen.width); document.all.t_pop.style.left=LeftPosition; document.all.t_pop.style.top=TopPosition; document.all.t_pop.style.width=w; document.all.t_pop.style.height=h; parent.basefrm.t_pop.location.href=fileto; document.all.t_pop.style.visibility="visible"; } function OpenCalendar(flg){ w=215; h=188; LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; var OPWindow = window.open("../includes/calendar.php?flg="+flg,"Search","left="+LeftPosition+",top="+TopPosition+",toolbar=no,width="+w+",height="+h); OPWindow.focus(); } function open_lookup(w,h,fileto){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2-30 : 0; var op=window.open(fileto+"","lookup","left="+LeftPosition+",top="+TopPosition+",toolbar=0,width="+w+",height="+h+",directories=no,menubar=no,resizable=0,scrollbars=yes"); op.focus(); } function sel_lookup(value,sel){ arr_sel=value.split('`'); /* sizearr=arr_sel.length-1; var buff=""; for(var i=0;i<sizearr;i++){ buff+=arr_sel[i]; buff+=i+='\n'; } alert(buff); */ switch(sel){ case "tax": window.parent.opener.DATA.tax.value=arr_sel[1]; window.close(); break; } } function send_del(arr_name,detail,pathto,file_send){ if(arr_name.length==0){ alert('No Selected data...'); }else{ var conf=confirm("Do You really want to Delete "+detail+" Y/N ?"); data_text=""; for(var i=0;i<arr_name.length;i++){ index_buff=arr_name[i].split('`'); data_text+=index_buff[0]+'`'; } if(conf){ parent.basefrm.location.href="send_"+file_send+".php"+pathto+"&index_data="+data_text; } } } //-->