This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(exports) { | |
| var _control = document.getElementById("my-control"); | |
| var _scroll = document.getElementById('my-scroll'); | |
| var timer = null; | |
| function addEvent(ele, type, fn) { | |
| if (window.attachEvent) { | |
| return ele.attachEvent("on" + type, fn) | |
| } else if (window.addEventListener) { | |
| return ele.addEventListener(type, fn, false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var zebra = function(klass) { | |
| var table = document.getElementsByTagName("table"); | |
| var reg = new RegExp("(^|\s)" + klass + "(\s|$)"); | |
| // var reg = /(^|\s)main\-table(\s|$)/ | |
| for (var i = 0; i < table.length; i++) { | |
| var cls = table[i].getAttribute("class"); | |
| if (reg.test(cls)) { | |
| var tr = table[i].getElementsByTagName('tr'); | |
| for (var j = 1; j < tr.length; j++) { | |
| if (j % 2 == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " ====================================================================================== | |
| " File : .vimrc | |
| " Author : Wu Jie | |
| " Last Change : 12/02/2009 | 12:02:28 PM | Wednesday,December | |
| " Description : | |
| " ====================================================================================== | |
| "///////////////////////////////////////////////////////////////////////////// | |
| " exVim global settings | |
| " NOTE: you should change to your own settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getDate(){ | |
| var param = arguments, | |
| date = new Date(); | |
| if(param.length==0){ | |
| return changeDateType(date); | |
| }else if(param.length==1){ | |
| if(param[0].toString().indexOf("+")!="-1"){ | |
| var nowTime = date.getTime(), | |
| preDate = param[0].substr(1,param[0].length-1), | |
| preDateTime = Number(preDate)*24*60*60*1000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.prototype.unique = | |
| function() { | |
| var a = []; | |
| var l = this.length; | |
| for(var i=0; i<l; i++) { | |
| for(var j=i+1; j<l; j++) { | |
| if (this[i] === this[j]) | |
| j = ++i; | |
| } | |
| a.push(this[i]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //1-9组成的三个三位数最小是123,最大是987。 | |
| //因为第三个是第一个的三倍,所以第一个数的最大值不可能大于329。 | |
| for (var j = 123; j < 330; j++) { | |
| (function(e) { | |
| var f = e * 2, | |
| g = e * 3, | |
| t = e.toString() + f + g, | |
| rg = /0/g, | |
| reg = /(?:^|)(\w{1}).*\1/g; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myAjax = { | |
| // XMLHttpRequest IE7+, Firefox, Chrome, Opera, Safari ; ActiveXObject IE6, IE5 | |
| xhr: window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'), | |
| get: function (url, callback) { | |
| this.xhr.open('get', url); | |
| this.onreadystatechange(callback, this.xhr); | |
| this.xhr.send(null); | |
| }, | |
| post: function (url, data, callback) { | |
| this.xhr.open('post', url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //一种用普通的字符串的方法,另外一种用正则,还是正则的扩展性高一点。。 | |
| //方法一:字符串方法 | |
| function ifRepeat(str) { | |
| var ss = str; | |
| for (var i = 0; i < ss.length; i++) { | |
| var cha = ss.charAt(i); | |
| var sub = ss.substring(0,i)+ss.substring(i+1); | |
| if (sub.indexOf(cha)!=-1) { | |
| console.log("有重复"); |
NewerOlder