(function () { var n = { c: function (t, e) { //console.log("c"); //把i(15)的d数组转换成字串 for (var i = "", n = 0; n < t.length; n++) i += e[parseInt(t[n])]; return i }, d: function (t, e) { if ("" == t) return ""; if (…
这篇文章主要介绍了JS判断字符串长度的5个方法,并且区分中文和英文,需要的朋友可以参考下 目的:计算字符串长度(英文占1个字符,中文汉字占2个字符)   方法一:    代码如下: String.prototype.gblen = function() {     var len = 0;     for (var i=0; i<this.length; i++) {       if (this.charCodeAt(i)>127 || this.charCodeAt(i)==94) {  …
var  questionId = []; var anSwerIdValue = []; ////javascript数组扩展indexOf()方法 Array.prototype.indexOf = function (e) { for (var i = 0, j; j = this[i]; i++) { if (j.indexOf(e) != -1) { return i; } } return -1; } if (anSwerIdValue.length < 14) { alert(&quo…
js判断字符是否为空的方法: //判断字符是否为空的方法 function isEmpty(obj){ if(typeof obj == "undefined" || obj == null || obj == ""){ return true; }else{ return false; } } 使用示例: if (!isEmpty(value)) { alert(value); }…
<html> <head> <script language="javascript" type="text/javascript"> /*判断IP的函数*/ function checkip(form){var pattern=/^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}…
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Ty…
//可自由选择精确度 如:签到时间:2018-11-07 11:00:00 签退时间:2018-11-07 10:59:59 //判断时间先后 //统一格式 var a = $("#fdtmInDate").val(); var aa = a.split('T'); if (aa.length == 2) { $("#fdtmInDate").val(aa[0] + " " + aa[1]); } a = $("#fdtmOffDate…
//qq交谈 var nowtimes= new Date(); var starttimes="16:30"; var endtimes="23:59"; var timestrings=nowtimes.getHours()+":"+nowtimes.getMinutes(); function qqchats1(){ if(!time_range (starttimes,endtimes,timestrings)){ var list =…
var time_range = function (beginTime, endTime, nowTime) { var strb = beginTime.split (":"); if (strb.length != 2) { return false; } var stre = endTime.split (":"); if (stre.length != 2) { return false; } var strn = nowTime.split ("…
judgeDay(sDate1, sDate2) { const sDate1 = `${new Date(sDate1).getFullYear()}-${new Date(sDate1).getMonth() + 1 > 9 ? new Date(sDate1).getMonth() + 1 : '0' + (new Date(sDate1).getMonth() + 1)}-${new Date(sDate1).getDate() > 9 ? new Date(sDate1).getDa…