最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

常用的JavaScriptWEB操作方法分享_javascript技巧

来源:动视网 责编:小采 时间:2020-11-27 21:34:57
文档

常用的JavaScriptWEB操作方法分享_javascript技巧

常用的JavaScriptWEB操作方法分享_javascript技巧:数组方法集 Angela.array = { //# 数组方法 // index, 返回位置! 不存在则返回 -1; index: function (t, arr) { //# 返回当前值所在数组的位置 if (arr.indexOf) { return arr.indexOf(t); } for (var i = a
推荐度:
导读常用的JavaScriptWEB操作方法分享_javascript技巧:数组方法集 Angela.array = { //# 数组方法 // index, 返回位置! 不存在则返回 -1; index: function (t, arr) { //# 返回当前值所在数组的位置 if (arr.indexOf) { return arr.indexOf(t); } for (var i = a


数组方法集

cookie方法集

url方法集

正则表达式方法集

字符串方法集

加密方法集

日期方法集

输出时间 var pre = '0' ; formatType = formatType || 'YYYY-MM-DD' weeks = weeks || '日一二三四五六'; time = time || new Date(); //格式化时间 return (formatType || '') .replace(/yyyy|YYYY/g, time.getFullYear()) .replace(/yy|YY/g, Tydic.string.addPre(pre, time.getFullYear() % 100), 2) .replace(/mm|MM/g, Tydic.string.addPre(pre, time.getMonth() + 1, 2)) .replace(/m|M/g, time.getMonth() + 1) .replace(/dd|DD/g, Tydic.string.addPre(pre, time.getDate(), 2)) .replace(/d|D/g, time.getDate()) .replace(/hh|HH/g, Tydic.string.addPre(pre, time.getHours(), 2)) .replace(/h|H/g, time.getHours()) .replace(/ii|II/g, Tydic.string.addPre(pre, time.getMinutes(), 2)) .replace(/i|I/g, time.getMinutes()) .replace(/ss|SS/g, Tydic.string.addPre(pre, time.getSeconds(), 2)) .replace(/s|S/g, time.getSeconds()) .replace(/w/g, time.getDay()) .replace(/W/g, weeks[time.getDay()]) ; } //倒计时 , countDown: function (opt) { //# 倒计时 var option = { nowTime: 0 // 当前时间, ,2013/02/01 18:30:30 , endTime: 0 //截止时间 ,2013/02/01 18:30:30 , interval: 1 //间隔回调时间,秒 , called: function (day, hour, second, minute) { }//每次回调 , finaled: function () { } //完成后回调 } , opts = {} , timer = null ; opts = Tydic.extend(option, opt); //当前时间 if (!opts.nowTime) { opts.nowTime = (new Date()).getTime(); } else { opts.nowTime = this.parse(opts.nowTime); } //当前时间 if (!opts.endTime) { opts.endTime = (new Date()).getTime(); } else { opts.endTime = this.parse(opts.endTime); } timer = setInterval(loop, opts.interval * 1e3); // 循环 function loop() { var ts = opts.endTime - opts.nowTime //计算剩余的毫秒数 , dd = parseInt(ts / 8.64e7) //计算剩余的天数 , hh = parseInt(ts / 3.6e7 % 24)//计算剩余的小时数 , mm = parseInt(ts / 6e4 % 60)//计算剩余的分钟数 , ss = parseInt(ts / 1e3 % 60)//计算剩余的秒数 ; //当前时间递减 opts.nowTime += opts.interval * 1e3; if (ts <= 0) { clearInterval(timer); opts.finaled(); } else { opts.called(dd, hh, mm, ss); } } } };

浏览器检测方法集

json方法

extend方法

类型判断的方法

文档

常用的JavaScriptWEB操作方法分享_javascript技巧

常用的JavaScriptWEB操作方法分享_javascript技巧:数组方法集 Angela.array = { //# 数组方法 // index, 返回位置! 不存在则返回 -1; index: function (t, arr) { //# 返回当前值所在数组的位置 if (arr.indexOf) { return arr.indexOf(t); } for (var i = a
推荐度:
标签: 分享 使用 技巧
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top