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

ʵÓÃµÄ JavaScript ²âÊÔ¼°Ð§Ñ鹤¾ß

JavaScript ÊÇÒ»¿îÇ¿´óµÄ¹ã·ºÔËÓÃÓÚÏÖ´úWebÕ¾µã¼°Ó¦ÓõĽű¾ÓïÑÔ¡£×÷Ϊһ¸ö¼¼ÒÕ¾«Õ¿µÄ Web ¿ª·¢Õߣ¬ÕÆÎÕJavaScript¿ÉÒÔÔöÇ¿Óû§µÄʹÓÃÌåÑ飬Ìṩ½»»¥¼°¸»¿Í»§¶ËµÈ¹¦ÄÜ¡£
¾¡¹ÜJavaScript µÄÓï·¨·Ç³£¼òµ¥£¬µ«¶ÔÓÚд³ÌÐò¶øÑÔÈÔÈ»ÊÇÀ§ÄÑÖØÖØ£¬¾ÍÊÇÒòΪËüµÄÔËÐл·¾³£º»ùÓÚWebä¯ÀÀÆ÷¡£
ÒÔÏÂÄú¿ÉÒÔ¿´µ½ÊÕ¼¯µÄ8¸öʵÓÃµÄ JavaScript ²âÊÔ¼°Ð§Ñ鹤¾ß£¬ËüÃǶ¼¿ÉÒÔÔÚ²»Í¬»·¾³Ï½øÐе¥Ôª²âÊÔ¼°Ð£Ñé²âÊÔÄúµÄ½Å±¾¡£
JSLint
JSLintÊÇ»ùÓÚWebµÄÑéÖ¤JavaScript´íÎó´úÂëµÄ¹¤¾ß¡£ËüÓµÓеŦÄܼ°Ìض¨µÄÉèÖÃÀ´Ê¹ÓÃÄúµÄÐèÇó£¬×Ô¶¨ÒåÄãµÄÑéÖ¤Ëã·¨¡£
JsUnit
JsUnitÊÇÒ»¿îÔÚ¿Í»§¶Ë(ÔÚä¯ÀÀʱ)µÄµ¥Ôª²âÊÔJavaScript¿ò¼Ü¡£¶ÔJavaScript¶øÑÔ£¬JUnit¾ÍÏñÊÇËüµÄÒ»¸ö¶Ë¿Ú¡£µ±È»ËüÒ²¿ÉÒÔÔÚ¶à ¸öä¯ÀÀÆ÷¡¢¶à¸ö»úÆ÷µÄ²»Í¬²Ù×÷ϵͳÖÐ×Ô¶¯ÔËÐС£ËüµÄ·¢Õ¹Ê¼ÓÚ2001Äê1Ô¡£
J3Unit
J3UnitÊÇÒ»¸öÃæÏò¶ÔÏóµÄJavaScriptµ¥Ôª²âÊÔ¿ò¼Ü¡£J3UnitÔÚÍøÒ³ä¯ÀÀÆ÷ÖÐÖ±½ÓÔËÐÐJavaScriptµÄ²âÊÔ£¬Ò²¿ÉÒÔ×Ô¶¯ÔËÐÐ JUnit ºÍ Jetty¡£J3UnitÊǽ¨Á¢ÔÚJUintºÍScript.aculo.usµÄ»ù´¡Ö®ÉÏÀ´¸üºÃµØʵÏÖ×Ô¶¯ÔËÐÐJavaScript µ¥Ôª²âÊÔ¡£ÃæÏò¶ÔÏóµÄJavaScriptµ¥Ôª²âÊÔÊÇÓÉScript.aculo.usµÄTest.Unit.Runner¶ÔÏó±àдµÄ£¬»ùÓÚ prototype JavaScript¿â¡£
Crosscheck
CrosscheckÊÇÒ»¿î¿ªÔ´µÄУÑéä¯ÀÀÆ÷ÖеÄJavaScript²âÊÔ¿ò¼Ü¡£Ëü¿ÉÒÔ°ïÖúÄúÔÚ²»Í¬µÄä¯ÀÀÆ÷ÖУ¬ÖîÈ磺Internet Explorer¡¢FirefoxµÈ£¬¶ø²»ÐèÒªÒ» Ò»°²×°ËûÃÇÀ´È·ÈÏÄúµÄ´úÂëÊÇ·ñÕýÈ·¡£ÄúΨһÐèÒªµÄÊDZØÐëÒªÓÐJavaÐéÄâ»ú»·¾³¡£
YUI Test
YUI²âÊÔÊÇÒ»¿î»ùÓÚä¯ÀÀÆ÷£¬Ìṩ½â¾ö·½°¸µÄ²âÊÔ¿ò¼Ü¡£Ê¹ÓÃYUI£¬Äú¿ÉÒÔ·½±ãµØÌí¼Óµ¥Ôª²âÊÔ£¬Ñ°ÇóJavaScript½â¾ö·½°¸¡£ËüÊÇÓÉ Yahoo! UI Library¿ª·¢µÄÒ»¸öJavaScriptMVC²âÊÔ²å¼þ£¬Äܹ»ÈÃÄãÄ£·¶´ó²¿·ÖDOM¶¯×÷£¬±ÈÈçд£¬ÍÏק£¬±ÈÈçÄ£·¶AJAXÏìÓ¦£¬²¢ÇÒÄܹ»Ê¹ÓöÏÑÔ (assertions)¡£ËüÄܹ»Ïóº¯ÊýÒ»ÑùÔËÐУ¬²¢ÇÒÄܹ»ÔÚ²»Í¬µÄconsole´°¿Ú½øÐм¯³É²âÊÔ¡£ËäÈ»Ëü²»ÊÇÔÚÈκΠxUnit ¿ò¼Ü»ù´¡ÉÏ¿ª·¢¶øÀ´£¬µ«YUI TestÈÔÈ»ÓкܶànUnit ºÍ JUnitµÄËù¾ßÓеÄÌØÐÔ¡££¨ While not a direct port from any specific xUnit framework, YUI Test does derive some characteristics from nUnit and JUnit. Õâ¶Î·­ÒëµÃ²»ºÃ£¬µ«ÏàÐÅ´óÖÂÒâ˼ÊǶԵģ©¡£
Regular Expression Tool
Regular Expression Tool£¨ÕýÔò±í´ïʽ¹¤¾ß£©ÊÇÒ»¿îÔÚÏß¹¤¾ß£¬ÓÃÀ´²âÊÔÄúµÄÕýÔò±í´ïʽ´úÂëÊÇ·ñÕýÈ·¡£µ±ÄúÏë¿ìËÙ²âÊÔ¸÷ÖÖÎı¾Àý×ÓµÄÕýÔò±í´ïʽʱ·Ç³£µÃÐÄÓ¦ÊÖ¡£
JS


Ïà¹ØÎĵµ£º

Javascriptѧϰ±Ê¼ÇÒ» ¶ÔÏó

 ¼ìË÷:
1 ÓÃ||À´Ìî³äĬÈÏÖµ
var status = flight.status || "unknown";
2 ʹÓÃ&&·ÀÖ¹TypeError
flight.equipment.model //throw "TypeError"
flight.equipment && flight.equipment.model //undefined

ÒýÓÃ
var a={},b={},c={};
document.writeln(a===b); //false
Ô­ÐÍ
Javascript ......

Javascript DOMѧϰ±Ê¼Ç1


·µ»ØÒ»¸ö¸ø¶¨idÊôÐÔÖµµÄÔªËؽڵãµÄ¶ÔÏó
document.getElememtById(id) 
·µ»ØÒ»¸ö°üº¬ËùÓиø¶¨±êÇ©µÄÔªËصÄÊý×é 
document.getElementsByName(tag)
»ñÈ¡ÔªËØÊôÐÔ
document.getAttribute(attribute)
ÉèÖÃÔªËØÊôÐÔÖµ
document.setAttribute(attribute)
......

cssºÍjavascriptÔÚIEºÍFirefoxÖжþÊ®Èý¸ö²»Í¬µã

Ò»¡¢document.formName.item(“itemName”) ÎÊÌâ
ÎÊÌâ˵Ã÷£ºIEÏ£¬¿ÉÒÔʹÓà document.formName.item(“itemName”) »ò document.formName.elements ["elementName"]£»FirefoxÏ£¬Ö»ÄÜʹÓÃdocument.formName.elements["elementName"]¡£
½â¾ö·½·¨£ºÍ³Ò»Ê¹ÓÃdocument.formName.elements["elementName" ......

JavaScriptÖÐArray£¨Êý×飩µÄÊôÐԺͷ½·¨

Êý×éÓÐËÄÖÖ¶¨ÒåµÄ·½Ê½
ʹÓù¹Ô캯Êý£º
var a = new Array();
var b = new Array(8);
var c =
new Array("first", "second", "third");
»òÕßÊý×éÖ±½ÓÁ¿£º
var d = ["first",
"second", "third"];
ÊôÐÔ
ArrayÖ»ÓÐÒ»¸öÊôÐÔ£¬¾ÍÊÇlength£¬length±íʾµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ