addLoadEvent.js
function addLoadEvent(func){
var oldonLoad = window.onload;
if(typeof window.onload!='function'){
window.onload = func;
}
else{
window.onload = function(){
oldonload();
func();
}
}
}
insertAfter.js
function insertAfter(newElement,targetElement) {
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement) {
parent.appendChild(newElement);
} else {
parent.insertBefore(newElement,targetElement.nextSibling);
}
}
/**
* [addClass 追加一个新class]
* @param {[type]} element [description]
* @param {[type]} value [description]
*/
function addClass(element, value) {
if (!element.className) {
element.className = value;
} else {
newClassName = element.className;
newclassName = " ";
newclassName += value;
element.className = newclassName;
}
}