Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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)

1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="return f ......

JavascriptÈÕÆÚ¸ñʽ ÕýÔò yyyy MM dd

reg = /^((((((0[48])|([13579][26])|([2468][048]))00)|([0-9][0-9]((0[48])|([13579][26])|([2468][048]))))-02-29)|(((000[1-9])|(00[1-9][0-9])|(0[1-9][0-9][0-9])|([1-9][0-9][0-9][0-9]))-((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30))|(((0[1-9])|(1[0-2]))-((0[1-9])|(1[0-9])|(2[0-8]))))))$/i; ......

JavaScript_Ñ­»·26¸öÓ¢ÎÄ×ÖĸµÄ·½·¨

×î½üÔÚCSDNÉÏÓÐÈËÎÊ£¬ÔõôÓÃJSÑ­»·26¸öÓ¢ÎÄ×Öĸ£¬Ï붼ûÏ룬дÏÂÒÔÏ´úÂë
<script type="text/javascript">
<!--
var character = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z");
for(var i=0;i<25;i++)
{
alert(character[i]);
} ......

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç
 
Ò»¡¢          Ç°ÑÔ
http://blog.csdn.net/soldierluo/archive/2010/02/25/5326520.aspx
 
¶þ¡¢          »Ø¹é¼òµ¥¡¢»ù±¾ÀàÐÍ
http://blog.csdn.net/soldierluo/archive/2010/02 ......

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£ºÒ»¡¢Ç°ÑÔ

¡¶Îò͸JavaScript¡·Ñ§Ï°±Ê¼Ç
 
Ô­ÎĵØÖ·£ºhttp://www.cnblogs.com/leadzen/archive/2008/02/25/1073404.html
 
ÕâÊÇÒ»±¾ºÜÐÎÏóÉú¶¯µÄÊ飬ʹÎÒÃÇ¿ÉÒÔ¸üÉîµØÁ˽âÁËJavaScript¡£
 
ÒýÑÔ
 
   ±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ