替代jquery

如果不需要过多操作,不引用jquery

1、document.ready :$(function(){})

http://www.cnblogs.com/a546558309/p/3478344.html

document.ready = function (callback) {
            ///兼容FF,Google
            if (document.addEventListener) {
                document.addEventListener('DOMContentLoaded', function () {
                    document.removeEventListener('DOMContentLoaded', arguments.callee, false);
                    callback();
                }, false)
            }
             //兼容IE
            else if (document.attachEvent) {
                document.attachEvent('onreadytstatechange', function () {
                      if (document.readyState == "complete") {
                                document.detachEvent("onreadystatechange", arguments.callee);
                                callback();
                       }
                })
            }
            else if (document.lastChild == document.body) {
                callback();
            }
        }

2、待续

http://www.alixixi.com/web/a/2013062889574.shtml

原文地址:https://www.cnblogs.com/mitang/p/5019329.html