標籤:style blog http java os io for cti
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>div div{ border:#ccc solid 1px; margin-bottom:2px;}</style><title>無標題文檔</title><script src="../../inc/jquery-2.0.3_code.js"></script><script>//alert($.Snow)//alert($("#div1").html)(function($){ var doll = function() { return new doll.fn.init( );}; doll.fn = doll.prototype = {constructor: doll,init:function(){},fx:function(){alert(‘這是類庫的一個執行個體化方法[fx]‘);}}; doll.fn.init.prototype = doll.fn; doll.tool=function(){ alert("外掛程式的工具方法測試"); }doll.mkdiv =function(str){ var div = document.createElement(‘div‘); div.innerHTML = str;div.style.border="#ccc solid 2px";div.style.marginBottom="20px";return div; }//第一種方法 擴充jQ的執行個體方法$.fn.foo2=function(){var i=0;for(p in this){i++;if(i>5){return;}alert(p);alert(this[p]);}}$.fn.toA=function(){ return [].slice.call( this );}//第二種方法 擴充jQ的執行個體方法$.fn.extend({ toArr: function(){ return [].slice.call( this ); }, //_get()返回一個原生的js集合 與jQ的 get方法是一樣的 _get: function(num){ return num == null ?// Return a ‘clean‘ arraythis.toArray() :// Return just the object( num < 0 ? this[ this.length + num ] : this[ num ] ); }, _test: function(){ var i=0;for(p in this){i++;if(i<2){alert(p);alert(this[p]);x=this[p];}} var j=0; for(p in x){j++; if(j>1){return;} alert(p);} },_prop:function(len,num){if( typeof len != "string" && typeof len != "number" ){try{for( p in this ){$(num).append($.doll.mkdiv(p + ":<br> <pre>" + ( len==-1 || len=="" ? this[p] : this[p] ) +"</pre>")); } }catch(e){alert(e)} }else{ this._prop_(len,num);}},_prop_:function(len,num){ num= typeof num == "undefined" ? 10 : num; len= typeof len == "undefined" ? 50: len;var i=0; try{for( p in this ){i++; if( i < num || num==-1){this.append($.doll.mkdiv( p + ":<br> <pre>" + ( len==-1 || len=="" ? this[p] : this[p].toString().substr(0,len) ) +"</pre>"));} }}catch(e){} return this;}}) window.doll= window._ = doll; //第一種方法擴充jQ的工具方法 window.jQuery.doll=window.doll; //第二種方法擴充jQ的工具方法 $.extend({tool2:function(){alert("外掛程式的工具方法測試2")},_prop:$.fn._prop ,_prof:function(id,obj){ obj= typeof obj == "undefined" ? window : obj; $._prop.apply(obj,[obj,id]);}});})(window.jQuery) $.doll.tool();//$.tool2();//$("#div1").foo2();$(function(){ console.log($("div").toArr()); $("div")._get()[0].innerHTML="dfsaf"; $("div")._get()[2].style.background="#ff0000"; ////$("div")._test(); $("#debug").append($.doll.mkdiv(‘hello word !‘)); $("#debug")._get()[0].appendChild( $.doll.mkdiv(‘hello word !----‘) ); //$("#debug")._prop( "",5); var a = {"first":1,"second":2,"third":3}; //$("#debug")._prop("",-1); //$("#debug")._prop.apply($("#debug"),["",-1]) //$("#debug")._prop.apply($("#debug"),["",-1]) //$("#debug")._prop.apply(window,[window,"#div1"])})//console.log({a:1,b:3})</script><script> $(function(){ // $("#debug")._prop.apply(window,[window,"#div1"]) // $._prop.apply(window,[window,"#div1"]) //_prof(id,obj) //擷取對象obj的所有屬性,並把屬性顯示到 id 為div1的層裡面 $._prof("#div1",window.$) //alert($("#div1").html()) })</script></head><body><div id="div1">aaaa</div><div >aaaa</div> <div >aaaa</div> <div >aaaa</div> <div id="debug" >0000000000000000000000000000</div> <?require_once(‘../../inc.php‘);?></body></html>