From d06b6956a75827a3950e8f3219198fbff255716e Mon Sep 17 00:00:00 2001 From: wchaowu Date: Fri, 16 Aug 2013 21:26:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AE=BE=E7=BD=AEindex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 87 ++++++++++++++++++------------------------------------ 1 file changed, 29 insertions(+), 58 deletions(-) diff --git a/index.html b/index.html index a9a6c0d..2e4fbfe 100644 --- a/index.html +++ b/index.html @@ -1,62 +1,33 @@ - - - - - - -var SimpleHandler = function() {}; // implements AjaxHandler -SimpleHandler.prototype = { - request: function(method, url, callback, postVars) { - var xhr = this.createXhrObject(); - xhr.onreadystatechange = function() { - if(xhr.readyState !== 4) return; - (xhr.status === 200) ? - callback.success(xhr.responseText, xhr.responseXML) : - callback.failure(xhr.status); - }; - xhr.open(method, url, true); - if(method !== 'POST') postVars = null; - xhr.send(postVars); - }, - createXhrObject: function() { // Factory method. - var methods = [ - function() { return new XMLHttpRequest(); }, - function() { return new ActiveXObject('Msxml2.XMLHTTP'); }, - function() { return new ActiveXObject('Microsoft.XMLHTTP'); } - ]; - - for(var i = 0, len = methods.length; i < len; i++) { - try { - methods[i](); - } - catch(e) { - continue; - } - // If we reach this point, method[i] worked. - this.createXhrObject = methods[i]; // Memoize the method. 记住该方法 - return methods[i](); - } - - // If we reach this point, none of the methods worked. - throw new Error('SimpleHandler: Could not create an XHR object.'); - } -}; -/* Usage. */ - -var myHandler = new SimpleHandler(); -var callback = { - success: function(responseText) { alert('Success: ' + responseText); }, - failure: function(statusCode) { alert('Failure: ' + statusCode); } -}; -myHandler.request('GET', 'script.php', callback); - -​ - - \ No newline at end of file + + From a4b762e9c17061e11cdfa196c6de88aabb75ab1a Mon Sep 17 00:00:00 2001 From: rockhe168 Date: Mon, 16 Sep 2013 21:34:52 +0800 Subject: [PATCH 2/3] hxh add --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 2e4fbfe..315ce10 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,8 @@ window.a=function(){document.body.style.visibility="visible"};function b(i){return window.document.getElementById(i)};var c="cd hahaya.github.com";var d=c.length;var e=0;var f=0;var g;function h(){if(e==d){if(0==f){b("codes_2").style.display="block";c="Login:hahaya";e=0;f=1;d=c.length}else if(1==f){b("codes_3").style.display="block";c="Password:********";e=0;f=2;d=c.length}else if(2==f){b("codes_4").style.display="block";c="Success,Welcome!";e=0;f=3;d=c.length}else{clearInterval(g);document.location="http://hahaya.github.com/blog"}}else{if(0==f){b("codes_1").innerHTML+=c.charAt(e)}else if(1==f){b("codes_2").innerHTML+=c.charAt(e)}else if(2==f){b("codes_3").innerHTML+=c.charAt(e)}else if(3==f){b("codes_4").innerHTML+=c.charAt(e)};e++}};g=setInterval(function(){h()},45); - + From bf431adc1b2b027ea9523add650c7392eb4f7353 Mon Sep 17 00:00:00 2001 From: wchaowu Date: Sat, 12 Oct 2013 11:03:29 +0800 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 306a101..edb7f18 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ --------------------------------------------------------------------------------

Javascript代码

Version 1.0.0
- Author:scott (吴超武)
+ Author:scott
有什么疑问和建议请发邮箱至Email:wchaowu@gmail.com
github: https://github.com/wchaowu/
本人积累的一些javascript的写法,参考了dhtmlx套件框架,javascript设计模式书籍、Jquery源代码,QQ空间、webQQ和新浪微博。