随笔分类 -  Javascript

js代码段
摘要:复制所有图片 (function() { var arr = []; var imgs = document.getElementsByTagName('img'); for (var i = 0, len = imgs.length; i < len; i++) { arr.push(imgs[i 阅读全文

posted @ 2020-04-17 11:58 木龙哥 阅读(174) 评论(0) 推荐(0)

String.prototype.formatWith
摘要:1 String.prototype.formatWith = function () { 2 var args = arguments; 3 var reg = /\{(\d+)\}/g; 4 return this.replace(reg, function (g0, g1) { 5 return args[+g... 阅读全文

posted @ 2017-05-24 11:02 木龙哥 阅读(302) 评论(0) 推荐(0)

js检查flash版本升级
摘要:1 for (var i = 0, len = navigator.plugins.length; i < len; i++) { 2 var plugin = navigator.plugins[i]; 3 4 if (plugin.name == 'Shockwave Flash') { 5 if (... 阅读全文

posted @ 2017-02-04 17:26 木龙哥 阅读(711) 评论(0) 推荐(0)

jquery.validate 一些技巧
摘要:1.Validator.element() Validates a single element, returns true if it is valid, false otherwise. https://jqueryvalidation.org/Validator.element/ 2.jQue 阅读全文

posted @ 2016-09-19 11:15 木龙哥 阅读(272) 评论(0) 推荐(0)

jquery 几点注意事项
摘要:jquery触发hover事件 使用mouseenter/mouseleave/mouseover/mouseout 阅读全文

posted @ 2015-03-16 13:00 木龙哥 阅读(191) 评论(0) 推荐(0)

js求指定时间的周一和周日
摘要:/*计算指定时间的的周一和周日 return=>{mondy:Date,sundy:Date} parms:{ date:指定时间,如果不指定则取当前时间 } */ f... 阅读全文

posted @ 2014-11-21 12:36 木龙哥 阅读(1205) 评论(0) 推荐(0)

js 几个特殊情况
摘要:alert(033-15);//12,前缀0用在直接量中,表示八进制 alert('033'-15);//18,前缀0用在字符串中,在(隐式)转换将忽略 alert(parseInt('033')-15);//12 function.apply([thisObj[,argArray]]) funct 阅读全文

posted @ 2014-06-04 22:07 木龙哥 阅读(204) 评论(0) 推荐(0)

js获取select默认选中的Option (非当前选中值)
摘要:js函数方法: 1 Demo: 1 2 7 test 8 24 29 不知道还有没有更方便快捷的方法,曾尝试通过jQuery获取$('#sel option[defaultSelected]'),可一直返回空。各位园友,我要的是select控件初始化的值,非select当前选... 阅读全文

posted @ 2014-05-06 17:07 木龙哥 阅读(9399) 评论(10) 推荐(0)

IE11中[if lt IE 9]兼容性问题
摘要:IE11不支持 ,蛋疼的IE!!! 阅读全文

posted @ 2014-03-30 11:35 木龙哥 阅读(1087) 评论(0) 推荐(0)

javascript 关闭页面提示
摘要:1 window.onbeforeunload = function (e) { 2 e = e || window.event; 3 // For IE and Firefox prior to version 4 4 ... 阅读全文

posted @ 2014-03-06 22:09 木龙哥 阅读(167) 评论(0) 推荐(0)

导航