本人自用的global.js库源码分享_javascript技巧_脚本

作者:官方彩票手机投注网站-服务器运维
var GLOBAL = {};GLOBAL.namespace = function { var arr = str.split, o = GLOBAL,i; for (i =  ? 1 : 0; i < arr.length; i++) { o[arr[i]] = o[arr[i]] || {}; o = o[arr[i]]; }};//Dom相关GLOBAL.namespace;GLOBAL.Dom.getNextNode = function  { node = typeof node == "string" ? document.getElementById : node; var nextNode = node.nextSibling; if  { return null; } if  { while  { if (nextNode.nodeType == 1) { break; } else { if  { nextNode = nextNode.nextSibling; } else { break; } } } return nextNode; }}GLOBAL.Dom.setOpacity = function { node = typeof node == "string" ? document.getElementById : node; if  { node.style.filter = 'alpha(opacity=' + level + ')'; } else { node.style.opacity = level / 100; }};GLOBAL.Dom.getElementsByClassName = function  { if  { root = typeof root == "string" ? document.getElementById : root; } else { root = document.body; } tag = tag || "*"; var els = root.getElementsByTagName, arr = []; for (var i = 0, n = els.length; i < n; i++) { for (var j = 0, k = els[i].className.split, l = k.length; j < l; j++) { if  { arr.push; break; } } } return arr;}GLOBAL.namespace;GLOBAL.Event.stopPropagation = function { e = window.event || e; if  { e.cancelBubble = true; } else { e.stopPropagation(); }};GLOBAL.Event.getEventTarget = function { e = window.event || e; return e.srcElement || e.target;};GLOBAL.Event.on = function(node, eventType, handler) { node = typeof node == "string" ? document.getElementById : node; if  { node.attachEvent("on" + eventType, handler); } else { node.addEventListener(eventType, handler, false); }};//Lang相关GLOBAL.namespace;GLOBAL.Lang.trim = function { return ostr.replace;};GLOBAL.Lang.isNumber = function;};function isString { return typeof s === "string";}function isBoolean { return typeof s === "boolean";}function isFunction { return typeof s === "function";}function isNull { return s === null;}function isUndefined { return typeof s === "undefined";}function isEmpty { return /^s*$/.test;}function isArray { return s instanceof Array;}GLOBAL.Dom.get = function  { node = typeof node === "string" ? document.getElementById : node; return node;}function $ { node = typeof node == "string" ? document.getElementById : node; return node;}GLOBAL.Lang.extend = function { var F = function() { }; F.prototype = superClass.prototype; subClass.prototype = new F(); subClass.prototype.constructor = subClass; subClass.superClass = subClass.prototype; if (superClass.prototype.constructor == Object.prototype.constructor) { superClass.prototype.constructor = superClass; }};GLOBAL.namespace;GLOBAL.Cookie = { read: function  { var cookieStr = ";" + document.cookie + ";"; var index = cookieStr.indexOf; if  { var s = cookieStr.substring(index + name.length + 3, cookieStr.length); return unescape(s.substring; } else { return null; } }, set: function  { var expDays = expires * 24 * 60 * 60 * 1000; var expDate = new Date(); expDate.setTime + expDays); var expString = expires ? ";expires=" + expDate.toGMTString() : ""; var pathString = ";path=/"; document.cookie = name + "=" + escape + expString + pathString; }, del: function  { var exp = new Date - 1); var s = this.read { document.cookie = name + "=" + s + ";expires=" + exp.toGMTString() + ";path=/"; } }};

本文由彩票投注软件发布,转载请注明来源

关键词: