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

JavaScript constructorÊôÐÔ

Definition and Usage
¶¨ÒåÓëÓ÷¨The constructor property is a reference to the function that created an object.
constructorÊôÐÔÊÇËù½¨Á¢¶ÔÏóµÄº¯Êý²Î¿¼Syntax
Óï·¨object.constructor
Example 1
¾ÙÀý
In this example we will show how to use the constructor property:
ÔÚÕâ¸ö¾ÙÀýÖÐÎÒÃǽ«Õ¹Ê¾ÈçºÎʹÓÃconstructorÊôÐÔ£º
<script type="text/javascript">
var test=new Array()
if (test.constructor==Array)
{document.write("This is an Array")}
if (test.constructor==Boolean)
{document.write("This is a Boolean")}
if (test.constructor==Date)
{document.write("This is a Date")}
if (test.constructor==String)
{document.write("This is a String")}
</script>
The output of the code above will be:
Êä³ö½á¹ûΪ£º
This is an Array
Example 2
¾ÙÀý2
In this example we will show how to use the constructor property:
ÔÚÕâ¸ö¾ÙÀýÖÐÎÒÃǽ«Õ¹Ê¾ÈçºÎʹÓÃconstructorÊôÐÔ£º
<script type="text/javascript">
function employee(name,jobtitle,born)
{
this.name=name
this.jobtitle=jobtitle
this.born=born
}
var fred=new employee("Fred Flintstone","Caveman",1970)
document.write(fred.constructor)
</script>
The output of the code above will be:
Êä³ö½á¹ûΪ£º
function employee(name, jobtitle, born)
{this.name = name; this.jobtitle = jobtitle; this.born = born;}
Try-It-Yourself Demos
³¢ÊÔÓëÑÝʾ
constructor - example 1
In this example we will show how to use the constructor property.
ÔÚÕâ¸ö¾ÙÀýÖÐÎÒÃǽ«Õ¹Ê¾ÈçºÎʹÓÃconstructorÊôÐÔ
constructor - example 2
In this example we will show how to use the constructor property.
ÔÚÕâ¸ö¾ÙÀýÖÐÎÒÃǽ«Õ¹Ê¾ÈçºÎʹÓÃconstructorÊôÐÔ
http://www.w3pop.com/learn/view/doc/jsref_constructor_array/


Ïà¹ØÎĵµ£º

Îò͸javascript [ÍÆ¼ö¸øÕÅ´ó¸ç¿´]

Òý×Ó
    ±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂÆµÄ¾À²øÖгÊÏÖ³öÎÞÏÞµÄÉú»úºÍ»îÁ¦¡£
    Êý¾ÝÌìÉú¾ÍÊÇÎľ²µÄ£¬×ÜÏë±£³Ö×Ô¼º¹ÌÓеı¾É«£»¶ø´úÂëÈ´ÌìÉú»îÆÃ£¬×ÜÏë¸Ä±äÕâ¸öÊÀ½ç¡£
   Äã¿´£¬Êý¾Ý´úÂë¼äµÄ¹ØÏµÓëÎïÖÊÄÜÁ¿¼äµÄ¹Ø ......

¼ÓËÙJavascript£ºDOM²Ù×÷ÓÅ»¯

Ô­ÎÄ£º¡¶Speeding up JavaScript: Working with the DOM¡·
×÷Õߣº KeeKim Heng, Google Web Developer
ÔÚÎÒÃÇ¿ª·¢»¥ÁªÍø¸»Ó¦Óã¨RIA£©Ê±£¬ÎÒÃǾ­³£Ð´Ò»Ð©javascript½Å±¾À´Ð޸ĻòÕßÔö¼ÓÒ³ÃæÔªËØ£¬ÕâЩ¹¤×÷×îÖÕÊÇDOM——»òÕß˵Îĵµ¶ÔÏóÄ£ÐÍ——À´Íê³ÉµÄ£¬¶øÎÒÃǵÄʵÏÖ·½Ê½»áÓ°Ïìµ½Ó¦ÓõÄÏìÓ¦ËÙ¶È¡£
DO ......

JavaScript¶¯Ì¬Ìí¼Óɾ³ý±í¸ñÐÐ(Ö§³ÖFireFox)


JavaScript¶¯Ì¬Ìí¼Óɾ³ý±í¸ñÐÐ(Ö§³ÖFireFox)
2006-08-16 12:47
¡¡¡¡Ð§¹ûͼÈçÏ£º
¡¡¡¡µã“Ìí¼Ó²ÎÓëÈË”°´Å¥¿ÉÒÔÌí¼ÓÒ»ÐУ¬Ã¿ÐкóÃæ¶¼ÓÐÒ»¸öɾ³ý°´Å¥£¬¿ÉÒÔɾ³ýËùÔÚÐУ¬“Çå¿Õ”Ôòɾ³ýËùÓеÄÐС£
¡¡¡¡ÕâÖÖЧ¹ûÔÚÐèÒªÅúÁ¿Ìí¼ÓÊý¾ÝµÄʱºò·Ç³£ÓÐÓ㬿ÉÒÔÔÚ¿Í»§¶ËÌí¼ÓÍêÒ»ÅúÊý¾Ý£¬È»ºóͨ¹ýAJAXÒ»´ÎÌá½ ......

107ÌõJavascriptµÄ³£ÓÃÓï¾ä

1.         document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËØµÄÃû³ÆºÍÖµ:document.getElementById( "±íµ¥ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ