Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÉè¼ÆÄ£Ê½_µÚ¶þ²¿·Ö_Á´Ê½µ÷ÓÃ

 Á´Ê½µ÷ÓÃÊÇÒ»¸öÓï·¨ÕÐÊý.°üº¬Á½¸ö²¿·Ö:
1.Ò»¸ö´´½¨HTMLÔªËØµÄ¶ÔÏóµÄ¹¤³§
2.¶ÔÕâ¸öHTMLÔªËØÖ´ÐеIJÙ×÷µÄ·½·¨
[¸öÈËÀí½â:½«HTMLÔªËØ°ü×°³É¶ÔÏó,ÔÚ¶ÔÏóÉÏÌí¼Ó·½·¨(ÖØµãÔÚreturn this)]
¹¹ÔìÆ÷
(function(){
//Use a private class
function _$(els){
this.elements = [];
for(var i=0; i<els.length; i++){
var element = els[i];
if(typeof element === "string"){
element = document.getElementById(element);
}
this.elements.push(element);
}
}
//
_$.prototype = {
each : function(fn){
for(var i=0; i<this.elements.length; i++){
fn.call(this,this.elements[i]);
}
return this;
},
setStyle : function(prop,val){
this.each(function(el){
el.style[prop] = val;
});
return this;
},
show : function(){
var that = this;
this.each(function(el){
that.setStyle("display","bloc");
});
return this;
},
addEvent : function(type,fn){
var add = function(el){
if(window.addEventListener){
el.addEventListener(type,fn,false);
}
else if(window.attachEvent){
el.attachEvent("on"+type,fn);
}
}
this.each(function(el){
add(el);
})
return this;
}
};
//the public interface remains the same
window.$ = function(){
return new _$(arguments);
}
})()

ʹÓûص÷´ÓÖ§³ÖÁ´Ê½µ÷Óõķ½·¨»ñÈ¡Êý¾Ý
Á´Ê½µ÷ÓúÜÊʺÏÓÚ¸³ÖµÆ÷·½·¨,µ«¶ÔÓÚȡֵÆ÷·½·¨,Äã¿ÉÄÜ»áÏ£ÍûËüÃÇ·µ»ØÄãÒªµÄÊý¾Ý¶ø²»ÊÇ·µ»Øthis.
window.API2 = window.API2 || function(){
var name = "hell";
this.setName = function(newName){
name = newName;
return this;
};
this.getName = function(callback){
callback.call(this,name);
return this;
}
};
var o2 = new API2;
o2.getName(console.log).setName("Menw").getName(console.log);
  
 


Ïà¹ØÎĵµ£º

javascriptÅжϱäÁ¿ÊÇ·ñ¶¨Òå

Ö±½ÓʹÓÃ䶨ÒåµÄJavascript±äÁ¿Ê±£¬Ò³Ãæ»á±¨´í²¢ÎÞ·¨Ö´ÐУ¬±ÈÈç
if (varName=="")
{
}
ÐèÒªÏÈÅжϱäÁ¿ÊÇ·ñ¶¨Ò壬ʹÓÃtypeofº¯Êý¿ÉÒÔÅжϣ¬ÈçÏÂʹÓãº
if (typeof(ipaddr)=='undefined')
{
window.alert('ipaddr䶨Òå');
} ......

100¶à¸ö³£ÓÃjavascriptÓï¾ä

1.document.write(""); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window->(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËØµÄÃû³ÆºÍÖµ:document.getElementById("±íµ¥ÖÐÔªËØµÄID號").name(»òvalue)
6.Ò»¸öСдת´ ......

¿ú̽jQuery——ÃæÏò¹Ç»ÒJavaScript³ÌÐòÔ±

µ± jQuery ÔÚ2006Äê1ÔÂÏÖÉíʱ£¬¸øÎҵĵÚÒ»Ó¡Ïó£¬ÊÇÕâÍæÒâ¶ù¹¹ÔìµÃºÜ¾«Ã÷¡£»ùÓÚCSSÑ¡ÔñÆ÷£¨CSS selectors£©À´´òµãÒ»ÇУ¬Æä˼·Ï൱ÁéÇÉ£¨²Î¿¼getElementsBySelector£©¡£µ«Á´ºÐ¹¤Ê£¨chaining stuff£©¿´ÆðÀ´¸üÏñ¸öàåÍ·£¬²¢ÇÒÕûÌå¿´À´£¬jQuery¿âÌṩµÄ¹¦Äܲ¢²»Äܸ²¸ÇËùÓлù´¡ÐԵĶ«Î÷¡£Òò´ËÎҶ϶¨£¬jQueryÖ»»áê¼»¨Ò»ÏÖ¡£
¼¸¸ö ......

ÔõÑùʹÓÃJavaScript´æ´¢Adobe AIRÓ¦ÓóÌÐòÊ×Ñ¡Ïî

 ±¾ÎÄÀ´×Ô£º
http://articles.sitepoint.com/article/adobe-air-pref-javascript
 
ÔÚÎҠ֮ǰµÄÌû×ÓÀ  ÎÒ¼¤¶¯µØ¿ªÊ¼ÁËÎҵĵÚÒ»¸öAIRÓ¦Ó㬽Ð×öHarpoon, ½öʹÓÃHTML, CSS, ºÍJavaScript¡£ÎÒµ±Ê±Ã»Ê±¼äÌÖÂÛµÄÒ»¸öÌØµã¾ÍÊÇ£¬Äã¿ÉÒÔʹÓÃÒ»¸öXMLÎļþ´æ´¢ºÍ¼ìË÷Ó¦ÓóÌÐòÊ×Ñ¡Ïî¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ