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

JavaScript ¼Ì³ÐÏê½â4

ÔÚ±¾ÕÂÖУ¬ÎÒÃǽ«·ÖÎöDouglas Crockford¹ØÓÚJavaScript¼Ì³ÐµÄÒ»¸öʵÏÖ
CrockfordÊÇJavaScript¿ª·¢ÉçÇø×îÖªÃûµÄȨÍþ£¬ÊÇJSON
¡¢JSLint
¡¢JSMin
ºÍADSafe
Ö®¸¸£¬ÊÇ¡¶JavaScript: The Good Parts¡·µÄ×÷Õß¡£
ÏÖÔÚÊÇYahooµÄ×ÊÉîJavaScript¼Ü¹¹Ê¦£¬²ÎÓëYUIµÄÉè¼Æ¿ª·¢¡£ ÕâÀïÓÐһƪÎÄÕÂ
Ïêϸ½éÉÜÁËCrockfordµÄÉúƽºÍÖø×÷¡£
µ±È»CrockfordÒ²ÊÇÎÒµÈС±²³ç°ÝµÄ¶ÔÏó¡£
µ÷Ó÷½Ê½
Ê×ÏÈÈÃÎÒÃÇ¿´ÏÂʹÓÃCrockfordʽ¼Ì³ÐµÄµ÷Ó÷½Ê½£º
×¢Ò⣺´úÂëÖеÄmethod¡¢inherits¡¢uber¶¼ÊÇ×Ô¶¨ÒåµÄ¶ÔÏó£¬ÎÒÃÇ»áÔÚºóÃæµÄ´úÂë·ÖÎöÖÐÏê½â¡£
// ¶¨ÒåPersonÀà
function Person(name) {
this.name = name;
}
// ¶¨ÒåPersonµÄÔ­ÐÍ·½·¨
Person.method("getName", function() {
return this.name;
});

// ¶¨ÒåEmployeeÀà
function Employee(name, employeeID) {
this.name = name;
this.employeeID = employeeID;
}
// Ö¸¶¨EmployeeÀà´ÓPersonÀà¼Ì³Ð
Employee.inherits(Person);
// ¶¨ÒåEmployeeµÄÔ­ÐÍ·½·¨
Employee.method("getEmployeeID", function() {
return this.employeeID;
});
Employee.method("getName", function() {
// ×¢Ò⣬¿ÉÒÔÔÚ×ÓÀàÖе÷Óø¸ÀàµÄÔ­ÐÍ·½·¨
return "Employee name: " + this.uber("getName");
});
// ʵÀý»¯×ÓÀà
var zhang = new Employee("ZhangSan", "1234");
console.log(zhang.getName()); // "Employee name: ZhangSan"

ÕâÀïÃæÓм¸´¦²»µÃ²»ÌáµÄÓ²ÉË£º
×ÓÀà´Ó¸¸Àà¼Ì³ÐµÄ´úÂë±ØÐëÔÚ×ÓÀàºÍ¸¸À඼¶¨ÒåºÃÖ®ºó½øÐУ¬²¢ÇÒ±ØÐëÔÚ×ÓÀàÔ­ÐÍ·½·¨¶¨Òå֮ǰ½øÐС£
ËäÈ»×ÓÀà·½·¨ÌåÖпÉÒÔµ÷Óø¸ÀàµÄ·½·¨£¬µ«ÊÇ×ÓÀàµÄ¹¹Ô캯ÊýÎÞ·¨µ÷Óø¸ÀàµÄ¹¹Ô캯Êý¡£
´úÂëµÄÊéд²»¹»ÓÅÑÅ£¬±ÈÈçÔ­ÐÍ·½·¨µÄ¶¨ÒåÒÔ¼°µ÷Óø¸ÀàµÄ·½·¨£¨²»Ö±¹Û£©¡£
µ±È»CrockfordµÄʵÏÖ»¹Ö§³Ö×ÓÀàÖеķ½·¨µ÷Óôø²ÎÊýµÄ¸¸Àà·½·¨£¬ÈçÏÂÀý×Ó£º
function Person(name) {
this.name = name;
}
Person.method("getName", function(prefix) {
return prefix + this.name;
});
function Employee(name, employeeID) {
this.name = name;
this.employeeID = employeeID


Ïà¹ØÎĵµ£º

a href=#Óë a href=javascript:void(0)µÄÇø±ð£¿

      Ç°Ìì×öµÄÒ³ÃæÊÇÒ»¸öiframeµ¯³ö´°¿Ú£¨ËµÃ÷һϣºÍ¬ÊÂÓÃjs½Å±¾¿ª·¢³öÀ´µÄ£©Àï´¥·¢Ò»¸ö<a>Á´½ÓµÄ°´Å¥¿ÉÔڸô°¿ÚÉϵ¯³öÒ»¸ödivÐü¸¡²ã¡£µ«ÊÇÿ´Îµã»÷£¬divÐü¸¡²ã¾Í×Ô¶¯Î»ÓÚIE´°¿ÚµÄ¶¥¶Ë£¬ÏÂÃæµÄiframe´°¿Ú°üº¬µÄÒ³Ãæ»á×Ô¶¯ÉÏÒÆ£¬Î»ÖôíÂÒÁË¡£
      ͬÊÂ˵Ö÷ÒªÊ ......

javascript»ñÈ¡ä¯ÀÀÆ÷µÄ¿í¶ÈºÍ¸ß¶È

<script language="JavaScript" type="text/JavaScript">
<!--
        function displayScreenSize()
        {
            var bodyWidth      ......

Eclipse¿ª·¢javascript¹¤¾ßjsEclipse½éÉÜ

      EclipseдjavascriptÊDZȽÏÍ´¿àµÄ,ÓÐÁËjsEclipseÕâ¸öÇ¿´óµÄjavascript±à¼­²å¼þ¾Í·½±ã¶àÁË,Õâ¸ö²å¼þÖ§³Ö´úÂëÍê³É,´ó¸Ùä¯ÀÀ,´íÎ󱨸æ,´úÂë»»ÐеȵÈ.
      °²×°jsEclipseºÜ·½±ã,ͨ¹ýHELP-Software Updates-Find and Install ÔÚURLÖмÈëhttp://www.interaktonline. ......

JavaScript ¼Ì³ÐÏê½â1

 
¼¸ºõÿ¸ö¿ª·¢ÈËÔ±¶¼ÓÐÃæÏò¶ÔÏóÓïÑÔ£¨±ÈÈçC++¡¢C#¡¢Java£©µÄ¿ª·¢¾­Ñé¡£ ÔÚ´«Í³ÃæÏò¶ÔÏóµÄÓïÑÔÖУ¬ÓÐÁ½¸ö·Ç³£ÖØÒªµÄ¸ÅÄî - ÀàºÍʵÀý¡£
ÀඨÒåÁËÒ»ÀàÊÂÎ﹫¹²µÄÐÐΪºÍ·½·¨£»¶øʵÀýÔòÊÇÀàµÄÒ»¸ö¾ßÌåʵÏÖ¡£ ÎÒÃÇ»¹ÖªµÀ£¬ÃæÏò¶ÔÏó±à³ÌÓÐÈý¸öÖØÒªµÄ¸ÅÄî - ·â×°¡¢¼Ì³ÐºÍ¶à̬¡£
µ«ÊÇÔÚJavaScriptµÄÊÀ½çÖУ¬ËùÓеÄÕâÒ»ÇÐÌØ ......

JavaScript ¼Ì³ÐÏê½â2

 ÕâÒ»ÕÂÎÒÃǽ«»áÖصã½éÉÜJavaScriptÖм¸¸öÖØÒªµÄÊôÐÔ£¨this¡¢constructor¡¢prototype£©£¬ ÕâЩÊôÐÔ¶ÔÓÚÎÒÃÇÀí½âÈçºÎʵÏÖJavaScriptÖеÄÀàºÍ¼Ì³ÐÆð×ÅÖÁ¹ØÖØÒªµÄ×÷Óá£
this
this±íʾµ±Ç°¶ÔÏó£¬Èç¹ûÔÚÈ«¾Ö×÷Ó÷¶Î§ÄÚʹÓÃthis£¬ÔòÖ¸´úµ±Ç°Ò³Ãæ¶ÔÏówindow£» Èç¹ûÔÚº¯ÊýÖÐʹÓÃthis£¬ÔòthisÖ¸´úʲôÊǸù¾ÝÔËÐÐʱ´Ëº¯ÊýÔÚʲ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ