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

Javascript Ö®apply()

1¡¢¶ÔÏóµÄ¼Ì³Ð£¬Ò»°ãµÄ×ö·¨ÊǸ´ÖÆ£ºObject.extend
prototype.jsµÄʵÏÖ·½Ê½ÊÇ£º
Object.extend = function(destination, source){
for (property in source) {
destination[property] = source[property];
}
return destination;
}
³ý´ËÖ®Í⣬»¹ÓÐÖÖ·½·¨£¬¾ÍÊÇ£ºFunction.apply£¨µ±È»Ê¹ÓÃFunction.callÒ²ÊÇ¿ÉÒԵģ©
apply·½·¨ÄܽٳÖÁíÍâÒ»¸ö¶ÔÏóµÄ·½·¨£¬¼Ì³ÐÁíÍâÒ»¸ö¶ÔÏóµÄÊôÐÔ
Function.apply(obj,args)·½·¨ÄܽÓÊÕÁ½¸ö²ÎÊý
    obj£ºÕâ¸ö¶ÔÏ󽫴úÌæFunctionÀàÀïthis¶ÔÏó
    args£ºÕâ¸öÊÇÊý×飬Ëü½«×÷Ϊ²ÎÊý´«¸øFunction£¨args-->arguments£©


Ïà¹ØÎĵµ£º

ÍøÒ³ÖÆ×÷Javascript¾­µäС¼¼ÇÉ×ܽá


ÍøÒ³ÖÆ×÷Javascript¾­µäС¼¼ÇÉ×ܽá
http://www.webjx.com  ¸üÐÂÈÕÆÚ£º2007-10-12 01:25  ³ö´¦£ºÍøÒ³½ÌÑ§Íø  ×÷ÕߣºÕ¾³¤ÕûÀí
ÿһÏî¶¼ÊÇJSÖеÄС¼¼ÇÉ£¬µ«Ê®·ÖµÄʵÓã¡
1.document.write(”"); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ ......

¼ò½àÇ¿´óµÄJavaScript±íµ¥ÑéÖ¤³ÌÐò

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>vForm±íµ¥ÑéÖ¤³Ì ......

javascriptÖÐloose typeµÄÓ°Ïì


var obj = new Object();
obj.name = "hello";
obj['name'] = "world";
alert(obj.name);
±»ÈËÎʵ½ÕâÑùÒ»¶Î´úÂ룬alertµÄ½á¹ûÓ¦¸ÃÊÇÊ²Ã´ÄØ£¿
Îһشð£ºhello #½á¹û´ó´íÌØ´í£¡
Ó¦¸ÃÊÇ“world”£¡£¡£¡
ÒòΪjsÊÇÒ»ÖÖËÉÉ¢ÀàÐ͵ÄÓïÑÔ£¬objËäÈ»±»ÉùÃ÷ÊÇÒ»¸ö¶ÔÏ󣬵«ÊǰÑËüµ±³ÉÊý×éÀ´·ÃÎÊҲûʲô²»¿ÉÒÔ¡£
ËäÈ» ......

ÔÚjavascript ÖÐʹÓÃJSON

ÒòΪJSON ÊÇ javascript µÄÒ»¸ö×Ó¼¯£¬ËùÒÔ£¬ÔÚjavascript ÖÐʹÓÃJSONÊǷdz£¼òµ¥µÄ¡£
   
   
js ´úÂë
 
var myJSONObject = {"bindings": [  
        {"ircEvent": "PRIVMSG", "method":&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ