摘要:
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... 阅读全文
摘要:
function hasFlashPlugin(){ try{ new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); return true; }catch(ex){ for(var i=0; i -1){ return true; } } r... 阅读全文
摘要:
//创建cookie function setCookie(name, value, expires, path, domain, secure) { var cookieText = encodeURIComponent(name) + '=' + encodeURIComponent(value); if (expires instanceof Date) { cookieText ... 阅读全文
摘要:
//添加事件兼容 function addEvent(obj, type, fn) { if (obj.addEventListener) { obj.addEventListener(type, fn); } else if (obj.attachEvent) { obj.attachEvent('on' + type, fn); } } //移除事件 functi... 阅读全文
摘要:
//动态加载js function loadScript(url) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; document.getElementsByTagName('head')[0].appendChild(script)... 阅读全文
摘要:
function getRect(element) { var rect = element.getBoundingClientRect(); var top = document.documentElement.clientTop; var left = document.documentElement.clientLeft; return { top : rect.t... 阅读全文
摘要:
Base.prototype.addRule = function (num, selectorText, cssText, position) { var sheet = document.styleSheets[num]; if (typeof sheet.insertRule != 'undefined') { sheet.insertRule(selectorText... 阅读全文
摘要:
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... 阅读全文
摘要:
Base.prototype.addClass = function (className) { for (var i = 0; i < this.elements.length; i ++) { if (!this.elements[i].className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'))){ this.... 阅读全文