摘要:
//封装根据classname选择元素function getByClass(oParent,sClass){ var oEle=oParent.getElementsByTagName('*'); var result=[]; var i=0; var re=new RegExp('\\s*'+sClass+'\\s*','i'); for(i=0;i<oEle.length;i++) { if(re.test(oEle[i].className)) { result.push(oEle[i]); } ... 阅读全文
摘要:
function getStyle(obj,attr) { if(obj.currentStyle) { return obj.currentStyle[attr]; } else { //return obj.getComputedStyle(obj,false).getPropertyValue([attr]); return document.defaultView.getComputedStyle(obj,false)[attr]; } }function startMove(obj, json,fn... 阅读全文
摘要:
/**DOM内容加载完毕后执行脚本代码(Dom标签加载完毕后执行代码)* fn:待执行的函数* scope: fn的执行作用域*/document.domReady = function (fn, scope) { var doc = document, readyFn = null; //W3C标准 if (doc.addEventListener) { readyFn = function () { doc.removeEventListener('DOMContentLoaded', readyFn, false); ... 阅读全文