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

JavaScript Undefined£¬NullÀàÐͺÍNaNÖµ

Ò» Undefined ÀàÐÍ
Ö»ÓÐÒ»ÖÖÖµ undefined
ÒÔÏÂÈýÖÖÇé¿ötypeof ·µ»ØÀàÐÍΪundefined
1. µ±±äÁ¿Î´³õʼ»¯Ê±
2. ±äÁ¿Î´¶¨Òåʱ
3. º¯ÊýÎÞÃ÷È··µ»ØÖµÊ±£¨º¯ÊýûÓзµ»ØÖµÊ±·µ»ØµÄ¶¼ÊÇundefined£©
undefined ²¢²»µÈͬÓÚ䶨ÒåµÄÖµ
typeof ²¢²»ÕæÕýÇø·ÖÊÇ·ñÊÇ䶨Òå
¿´ÒÔÏÂʾÀý´úÂ룺
var oTemp;
alert(typeof oTemp); // outputs "undefined"
alert(typeof oTemp2);// outputs "undefined"
alert(oTemp2 == undefined ); // ´íÎó oTemp2 䶨Òå ²»ÄÜʹÓóýÁËtypeofÖ®ÍâµÄ²»ÄÜÓÃÀ´oTemp2ÆäËûµÄÔËËã
µ±±äÁ¿
¶þ Null ÀàÐÍ
Ö»ÓÐÒ»¸önull£¬undefined ÊÇÓÉnullÅÉÉú´¦ÀíµÄ£¬Òò´Ëundefined == null
undefined ÊÇÉùÃ÷Á˵«ÊÇûÓгõʼ»¯µÄ¸Ã±äÁ¿£¬
null±íʾÉÐδ´æÔڵĶÔÏó
Èý NaN Öµ
ÊÇÒ»¸öÌØÊâÖµ£¬±íʾ·ÇÊý£¨Not a Number£©
ÀàÐÍת»»Ê§°Ü¾Í»á·µ»ØNaN
e.g. Òª°ÑÒ»¸öµ¥´Êblueת»»ÎªÊýÖµ¾Í»áʧ°ÜÒòΪûÓеȼ۵ÄÊýÖµ
NaN ²»µÈÓÚ×Ô¼º
¼´ NaN == NaN ÊÇ false
ÅжÏNaN ʹÓà isNaN();


Ïà¹ØÎĵµ£º

×Ô¼º¶¯ÊÖÓÃjavascriptдxpath

       ×Ô¼ºÒÔǰд¹ýһƪÎÄÕ£¬ÊǹØÓÚdomÏÂxpathµÄ±àд£¬²»¹ýÄÇÊǽèÖúä¯ÀÀÆ÷±¾ÉíµÄÌØÐÔ£¬Õâ´ÎÎÒÏëÓÃjavascripºÍÕýÔò±í´ïʽ´òÔì×Ô¼ºµÄxpath£¬²»¶à啰࣬¿´´úÂ룺
  
function xpath(n,m){
 if(/\]$/i.test(m)){
  var t1=[]
  var reg=/ ......

ÓÃjavascript¶¯Ì¬ÉèÖÃcssÑùʽµÄÖµ

 css¿ØÖÆÎ»Öãº
´¿Êý×Ö
el.style.posLeft = 0;
el.style.posTop = 0;
Êý×Ö+µ¥Î»
el.style.left = "0px";
el.style.top = "0px";
css¿ØÖÆÔªËصÄÑùʽ£º
document.getElementById("para").style.fontWeight ="bold";
»ò£¨ÆäËûÒ²ÊÇÕâÑù£©£º
document.getElementById("para").className ="strong"; ......

[ÕûÀí]JavaScript¶ÔÏó²Î¿¼´óÈ«(31¸ö)

B.1 anchor¶ÔÏó
¡¡¡¡Ê¹Óñê¼Ç´´½¨µÄHTMLÃèµãÄܱ»Ò»¸öÁ´½Ó×÷ΪĿ±êÈç¹ûêµã°üÀ¨HREF=ÌØÐÔ,ÔòËüÒ²ÊÇÒ»¸öÁ´½Ó¶ÔÏó¡£
¡¡¡¡anchor¶ÔÏóÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,Ëü±¾ÉíûÓÐÊôÐÔ·½·¨»òÕßʼþ´¦Àí³ÌÐò¡£
B.2 anchorsÊý×é
¡¡¡¡anchorsÊý×éÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,ÊÇÎĵµÄÚËùÓÐanchor¶ÔÏóµÄÒ»¸öÁбíÈç¹ûanchorÒ²ÊÇÒ»¸ölink ......

ÔÚb/s¿ª·¢Öо­³£Óõ½µÄjavaScript¼¼ÊõÕûÀí

Ò»¡¢ÑéÖ¤Àà
1¡¢Êý×ÖÑéÖ¤ÄÚ
  1.1 ÕûÊý
 /^(-|\+)?\d+$/¡¡¡¡²»¿ÉÒÔΪ¿Õ
 /^[-+]?\d*$/  ¿ÉÒÔΪ¿Õ
  1.2 ´óÓÚ0µÄÕûÊý £¨ÓÃÓÚ´«À´µÄIDµÄÑéÖ¤)
 /^\d+$/
  1.3 ¸ºÕûÊýµÄÑéÖ¤
 /^-\d+$/
  1.4 ÕûÊý²»ÄÜ´óÓÚiMax
 ¸ù¾ÝÉÏÃæµÄÕýÔò¿ÉÒÔд³ö¡£
  1.5 ÕûÊý²»ÄÜÐ¡Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ