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

JavaScript prototype ÊôÐÔ

¶¨ÒåÓëÓ÷¨
The prototype property allows you to add properties and methods to an
object.
prototypeÊôÐÔÔÊÐíÄãÏòÒ»¸ö¶ÔÏóÌí¼ÓÊôÐԺͷ½·¨
Syntax
Óï·¨
object.prototype.name=value
Example 1
ʵÀý
In this example we will show how to use the prototype property to add a
property to an object:
ÔÚÏÂÃæµÄÀý×ÓÖУ¬ÎÒÃǽ«ÑÝʾÈçºÎÓÃprototypeÊôÐÔÀ´ÏòÒ»¸ö¶ÔÏóÔö¼ÓÒ»¸öÊôÐÔ£º
<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)
employee.prototype.salary=null
fred.salary=20000
document.write(fred.salary)
</script>
The output of the code above will be:
Êä³ö½á¹ûΪ£º
20000


Ïà¹ØÎĵµ£º

JavaScript´úÂë(1)

//ºǫ́CSµ÷ÓÃǰ̨JS·½·¨
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script>CheckInput()</script>");
//УÑéÊäÈë¿òÊÇ·ñΪ¿Õ£¬Ð£ÑéÊÇ·ñÊÇÊý×Ö
<script type="text/javascript" language="javascript">
         function CheckInput ......

JAVASCRIPT·ÃÎʸ¸´°¿ÚµÄ±äÁ¿»ò·½·¨


AA.HTM
-------------------------------------
<!--
showModalDialogº¯ÊýµÄʹÓà  (ת)     
±¾·¶Àý¿ÉÒÔʵÏÖµ¯³öÒ»¸öģ̬´°¿Ú£¬²¢ÑÝʾÁËÁ½ÖÖ½ÓÊպʹ«µÝ²ÎÊýµÄ·½·¨£¬Í¬Ê±¿ÉÒÔ½ÓÊÜģ̬´°¿Ú·µ»ØµÄ¶à¸ö±äÁ¿   
-->
<html>    &nbs ......

javascriptµ÷Óø¸´°¿ÚµÄº¯ÊýºÍ±äÁ¿


javascriptµ÷Óø¸´°¿ÚµÄº¯ÊýºÍ±äÁ¿
·¢²¼ÈÕÆÚ£º2008-05-28×î½ü¸üУº2008-05-28À´Ô´£ºBHCODE×÷Õߣº
web¿ª·¢µÄʱºò£¬ÓÐʱºòÐèҪʹÓÃÆäËûÒ³ÃæÉÏдºÃµÄjavasriptº¯Êý¡¢±äÁ¿¡£È絯³ö´°¿ÚÐèҪʹÓø¸´°¿ÚÖеĺ¯Êý£¬¿ò¼Ü1ÐèҪʹÓÿò¼Ü2Öеĺ¯Êý¡£
µ÷Óú¯Êý¡¢±äÁ¿µÄ·½·¨Ò»Ñù£¬¶¼ÊÇÐèÒªÊ×ÏÈ»ñµÃÄãÐèÒªµ÷Óõĺ¯ÊýËùÔÚµÄwindow¶ÔÏó ......

JavaScript FAQ£¨¶þÊ®Èý£©

¶þÊ®¡¢Bookmarklet
1¡¢Ê²Ã´ÊÇBookmarklet£¿£¨What's a Bookmarklet?£©
Q£ºÊ²Ã´ÊÇBookmarklet£¿
A£ºBookmarkletÊÇÕû¸ö¶¼±»°üº¬ÔÚ³¬Á´½ÓURLÖеÄһС¶ÎJavaScript³ÌÐò¡££¨JavaScript URL¾ÍÊÇÕâ¸öÑù×Ó£º<a href="javascript:the code goes here">¡££©¶àÊýä¯ÀÀÆ÷ÔÊÐíÓû§Ìí¼ÓÕâЩJavaScript URLÊéÇ©£¬¾ÍÏñÌí¼ÓÆäËû³¬Á´½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ