Window.onload execution of window.onload = function () { function dom (ID) {return document.getElementById (ID) after page load is completed;} Dom ("Id1"). onclick = function () {this.innerhtml = ' welcome ';}} JQuery plug-in partial class-level plug-in development 1.1 add a new global function Jquery.fn = function () {} 1.2 adds multiple global functions Jquery.fn = function () {}jquery.fun = function () {}1.3 uses Jquery.extend (object); 1.3.1 Add function jquery.extend ({ fn:function () {}, fun:function () {} }) 1.3.2 Merge function jquery.extend ({ fn:function () {}},option) 1.4 uses namespace Jquery.plugin = {}2, object-level plug-in development $.fn.extend ({plugin: function (opt,callback) {} }) 2.1 declares a name under the jquery namespace $.fn.plugin = function () {};2.2 accepts the options parameter $.fn.plugin = function (options) {}2.3 exposes the default settings for plug-ins 2.3.1 Overwrite plug-in Parameters $.fn.plugin.defaults.foreground = ' Blue '; 2.3.2 by passing configuration parameters $ (' #green '). Hilight ({ foreground: ' Green '});
JavaScript and jquery Plugin development