摘要: function getClientSize(){ return window.innerWidth? {width:window.innerWidth,height:window.innerHeight}: {width:document.documentElement.clientWidth,height:document.documentElement.clientH... 阅读全文
posted @ 2016-04-26 23:01 天桥残局 阅读(202) 评论(0) 推荐(0) 编辑
摘要: var oDiv= document.getElementById("div"); oDiv.onmousedown= function(e){ var _this = this; var e= e || window.event; var diffX= e.clientX - _this.offsetLeft; var diffY= e.clientY - _this.of... 阅读全文
posted @ 2016-04-26 00:45 天桥残局 阅读(146) 评论(0) 推荐(0) 编辑
摘要: var oDiv= document.getElementById("div"); oDiv.onmousedown= function(e){ var _this = this; var e= e || window.event; var diffX= e.clientX - _this.offsetLeft; var diffY= e.clientY - _this.of... 阅读全文
posted @ 2016-04-25 23:43 天桥残局 阅读(104) 评论(0) 推荐(0) 编辑
摘要: function hasFlashPlugin(){ try{ new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); return true; }catch(ex){ for(var i=0; i -1){ return true; } } r... 阅读全文
posted @ 2016-04-25 15:27 天桥残局 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //创建cookie function setCookie(name, value, expires, path, domain, secure) { var cookieText = encodeURIComponent(name) + '=' + encodeURIComponent(value); if (expires instanceof Date) { cookieText ... 阅读全文
posted @ 2016-04-25 14:41 天桥残局 阅读(125) 评论(0) 推荐(0) 编辑
摘要: //添加事件兼容 function addEvent(obj, type, fn) { if (obj.addEventListener) { obj.addEventListener(type, fn); } else if (obj.attachEvent) { obj.attachEvent('on' + type, fn); } } //移除事件 functi... 阅读全文
posted @ 2016-04-25 14:29 天桥残局 阅读(119) 评论(0) 推荐(0) 编辑
摘要: //动态加载js function loadScript(url) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; document.getElementsByTagName('head')[0].appendChild(script)... 阅读全文
posted @ 2016-04-25 14:14 天桥残局 阅读(113) 评论(0) 推荐(0) 编辑
摘要: function getRect(element) { var rect = element.getBoundingClientRect(); var top = document.documentElement.clientTop; var left = document.documentElement.clientLeft; return { top : rect.t... 阅读全文
posted @ 2016-04-25 14:02 天桥残局 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Base.prototype.addRule = function (num, selectorText, cssText, position) { var sheet = document.styleSheets[num]; if (typeof sheet.insertRule != 'undefined') { sheet.insertRule(selectorText... 阅读全文
posted @ 2016-04-25 00:58 天桥残局 阅读(581) 评论(0) 推荐(1) 编辑
摘要: Base.prototype.css = function (attr, value) { for (var i = 0; i < this.elements.length; i ++) { if (arguments.length == 1) { if (typeof window.getComputedStyle != 'undefined') { r... 阅读全文
posted @ 2016-04-25 00:54 天桥残局 阅读(254) 评论(0) 推荐(0) 编辑