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

JavaScript isPrototypeOfºÍhasOwnPropertyʹÓÃÇø±ð

1¡¢isPrototypeOf
isPrototypeOfÊÇÓÃÀ´ÅжÏÖ¸¶¨¶ÔÏóobject1ÊÇ·ñ´æÔÚÓÚÁíÒ»¸ö¶ÔÏóobject2µÄÔ­ÐÍÁ´ÖУ¬ÊÇÔò·µ»Øtrue£¬·ñÔò·µ»Øfalse¡£
¸ñʽÈçÏ£º
object1.isPrototypeOf(object2);
object1ÊÇÒ»¸ö¶ÔÏóµÄʵÀý£»
object2ÊÇÁíÒ»¸ö½«Òª¼ì²éÆäÔ­ÐÍÁ´µÄ¶ÔÏó¡£
Ô­ÐÍÁ´¿ÉÒÔÓÃÀ´ÔÚͬһ¸ö¶ÔÏóÀàÐ͵IJ»Í¬ÊµÀýÖ®¼ä¹²Ïí¹¦ÄÜ¡£
Èç¹û object2 µÄÔ­ÐÍÁ´Öаüº¬object1£¬ÄÇô isPrototypeOf ·½·¨·µ»Ø true¡£
Èç¹û object2 ²»ÊÇÒ»¸ö¶ÔÏó»òÕß object1 ûÓгöÏÖÔÚ object2 ÖеÄÔ­ÐÍÁ´ÖУ¬isPrototypeOf ·½·¨½«·µ»Ø false¡£
ʹÓþÙÀýÈçÏ£º
var re = /^\s*/;
// ÕâÀﶨÒåÒ»¸öÕýÔò±í´ïʽ¶ÔÏó
// ÕâÀï¼ì²éRegExpÊDz»ÊÇreµÄÔ­ÐÎÁ´¶ÔÏó,·µ»Øtrue
var bIsptt = RegExp.prototype.isPrototypeOf(re);
 
 2¡¢hasOwnProperty
hasOwnPropertyÅжÏÒ»¸ö¶ÔÏóÊÇ·ñÓÐÃû³ÆµÄÊôÐÔ»ò¶ÔÏ󣬴˷½·¨ÎÞ·¨¼ì²é¸Ã¶ÔÏóµÄÔ­ÐÍÁ´ÖÐÊÇ·ñ¾ßÓиÃÊôÐÔ£¬¸ÃÊôÐÔ±ØÐëÊǶÔÏó±¾ÉíµÄÒ»¸ö³ÉÔ±¡£
Èç¹û¸ÃÊôÐÔ»òÕß·½·¨ÊǸà ¶ÔÏó×ÔÉí¶¨ÒåµÄ¶ø²»ÊÇÆ÷Ô­ÐÍÁ´Öж¨ÒåµÄ Ôò·µ»Øtrue;·ñÔò·µ»Øfalse;
¸ñʽÈçÏ£º
object.hasOwnProperty(proName);
ÅжÏproNameµÄÃû³ÆÊDz»ÊÇobject¶ÔÏóµÄÒ»¸öÊôÐÔ»ò¶ÔÏó¡£Ê¹ÓþÙÀýÈçÏÂ
// µÃµ½false£¬ ÒòΪ²»Äܼì²âÔ­ÐÍÁ´ÖеÄÊôÐÔ
var bStr = "Test String".hasOwnProperty("split");
// String¶ÔÏóµÄÔ­ÐÍÉϱ¾À´¾ÍÓÐÕâ¸öÊôÐÔ£¬×ÔÈ»·µ»Øtrue
var bStr1 = String.prototype.hasOwnProperty("split");
// ·µ»Øtrue£¬ÒòΪ²»ÊǼì²âÔ­ÐÍÖеÄÊôÐÔ
var bObj = ({fnTest:function(){}}).hasOwnProperty("fnTest");


Ïà¹ØÎĵµ£º

javascript»­Í¼±í·½·¨


ÈÕÖ¾Ô­ÎÄ£ºhttp://zzgziyu.blog.sohu.com/109589244.html
<script>
("<html
xmlns:v><style>v\\:*{behavior:url(#default#VML)}</style>")
var
ct1=new ct()
function ct(){
   
="green,yellow,red,blue,gray,purple".split(",")
&nb ......

JavaScriptÖг£ÓõÄʼþ

JavaScriptÖÐÓÐÒÔϳ£ÓõÄʼþ£¬ËüÃÇ¿ÉÒÔͨ¹ýJavaScriptÖеÄ×Ô¶¨Ò庯ÊýÀ´ÏìÓ¦
1.onclickʼþ
     µ¥»÷ʼþ£¬¼´Óû§µ¥»÷Êó±ê°´Å¥Ê±·¢ÉúµÄʼþ£¬¿ÉÒÔÔÚÒÔÏ»ù±¾¶ÔÏóÖвúÉú¸Ãʼþ£ºbutton,radio,checkbox,submit,reset
2.onchangeʼþ
     ¸Ä±äʼþ£¬Í¨³£·¢ÉúÔÚÒÔÏÂÁ½ÖÖÇé¿ö
& ......

javascriptͼƬÇл»Ð§¹û/´øÎÄ×Ö

´¿Í¼Æ¬°æ£º
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Slideshow</title>

<mce:script type="text/javascript" charset="utf-8"><!--
var galleryarra ......

[Javascript]typeofº¯ÊýÓëconstructorÊôÐÔ

½ñÌìżȻ¿´µ½ÁËconstructorÕâ¸ö¶«¶«£¬²»Ã÷°×ÓÃ;¡£Õҵ㶫Î÷±¸Íü
typeofº¯ÊýµÄÓ÷¨¿ÉÄܲ»ÓÃÎÒ¶à˵£¬´ó¼Ò¶¼ÖªµÀÔõôÓ᣶øconstructorÊôÐÔ´ó¼Ò¿ÉÄܾÍÄ°Éúµã¡£ÔÚ¡¶¾«Í¨JavaScript¡·Õâ±¾ÊéÖÐÓÐÌáµ½constructµÄÓ÷¨£¬µ«ÎÒÓÃ×Ô¼ºµÄ¼¸¸öä¯ÀÀÆ÷£¨IE7.0 / Firefox1.9 / Opera9.50£©²âÊԵĽá¹ûÈ´ºÍÊéÉÏ˵µÄ²»Ò»Ñù¡£µ«ÊÇÈÔÈ»ÊÇÓÐ°ì·¨Í ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ