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

Ò»¾ä»°Àí½âjavascript prototypeÊôÐÔ

Õâ¾ä»°ÊÇ£ºprototypeÖж¨ÒåµÄÊǶÔÏóʵÀýÒª·ÃÎʵÄÊôÐÔ»ò·½·¨µÄÒ»¸öÌæ²¹¡£
¾ÙÀý˵Ã÷һϣº
//1£©¶¨ÒåÁËÒ»¸ö¶ÔÏó£º
function A()
{
//¸ø¶ÔÏó¶¨ÒåÒ»¸öÊôÐÔ
this.f1="this is f1";
}
//2£©ÎÒÃÇ¿ÉÒÔÕâÑùʹÓöÔÏó£º
var a = new A();
alert(a.f1)//µ¯³öÏûÏ¢£ºthis is f1
//3£©ÎÒÃÇ¿ÉÒÔÀ©Õ¹¶ÔÏó£º
A.prototype.f1 = "this is new f1";
A.prototype.f2 = "this is f2";
//4£©¼ÌÐøʹÓöÔÏó£º
alert(a.f1)//µ¯³öÏûÏ¢£ºthis is f1¡¾²»ÊÇthis is new f1¡¿
alert(a.f2)//µ¯³öÏûÏ¢£ºthis is f2

˵Ã÷£ºµ±ÎÒÃÇʹÓöÔÏóʱ£¬Ê×ÏÈ´Ó¶ÔÏóµÄ¶¨ÒåÖÐÈ¥ÕÒ¶ÔÓ¦µÄÊôÐÔ£¬ÕÒ²»µ½ÔÙ´ÓprototypeÖÐÈ¥ÕÒ¡£
Èç4£©Öе÷ÓÃa.f1£¬¾ÍÄÜ´Ó¶ÔÏó±¾Éí¶¨ÒåÖÐÕÒµ½f1ÊôÐÔ£¬²»»áÔÙÈ¥prototypeÖÐÈ¥ÕÒf1ÊôÐÔ£¬ËùÒÔÀ©Õ¹µÄf1ÊôÐÔ¾ÍÓò»ÉÏÁË
¶øa.f2£¬ÔòÒòΪÔÚ¶ÔÏó±¾Éí¶¨ÒåÖÐûÓÐÕÒµ½f2ÊôÐÔ£¬ÄÇôҪ¼ÌÐø´ÓprototypeÖÐÑ°ÕÒÓÐûÓÐf2µÄ¶¨Ò壬ÕÒµ½¾Í·µ»ØËü


Ïà¹ØÎĵµ£º

CSS+JavaScriptʵÏֲ㼶ÏÔʾÒþ²Ø

/***************************by
garcon1986********************************/
¸ÐлCSDNµÄshan1119 °ïÎÒ½â¾öJavascript²¿·ÖµÄ´íÎó¡£
<mce:script language="JavaScript"><!--
function toggle(id,id2,id3) {
var state = document.getElementById(id).style.display;
if (state == 'block') {
......

Javascript³£ÓÃÆÁ±Î

1 >ÆÁ±Î¹¦ÄÜÀà
1.1 ÆÁ±Î¼üÅÌËùÓмü
<script. language="javascript">
<!--
function document.onkeydown(){
  event.keyCode = 0;
  event.returnvalue = false;
}
-->
</script>
1.2 ÆÁ±ÎÊó±êÓÒ¼ü
ÔÚbody±êÇ©Àï¼ÓÉÏoncontextmenu=self.event.returnvalue=false
»òÕß
<scri ......

ÇÉÓÃjavascript»ñµÃÏÂÔصØÖ·

ͻȻ¼äÏëÈ¥ÏÂÊ×fire in the holeµÄÁåÉù£¬ÓÚÊÇÓÃsosoÕÒÁËһϣ¬½øÈëÁËÊÖ»úÀÖÔ° £¨http://download.shouji.com.cn/do/wave?html=&inputname=wave&wname=Fire+in+the+hole+&thsubmit=%E6%90%9C%E7%B4%A2£©£¬Ñ¡Ôñfire in the hole£¬µ¯³ö¸ö´°¿Ú£¬ÌáʾÈÃÊäÈëÊÖ»úºÅÂë¡£ÔÎËÀ£¬²»¾ÍÏÂÊ׸èÂ»¹²»ÈÃÖ±½ÓÏ¡£ºÇºÇ£¬·¢ÏÖÍ ......

[ת]Top 10 Things that JavaScript Got Wrong

to make a note that I love JavaScript. This article is only meant for some fun, and for us to be aware of some its short-comings.
1. The Name. JavaScript is NOT Java
We'll start with a fun jab at the name choice. While it was originally called Mocha, and then LiveScript, it was later changed to J ......

ÓÐ¹Ø JavaScript µÄ 10 ¼þÈÃÈ˷ѽâµÄÊÂÇé

JavaScript ¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±» Web ¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇ DOM
API£¬Õâ¸ö±»´óÁ¿µÄ¿ª·¢ÓëÉè¼ÆʦËæÊÖÄéÀ´ÔöÇ¿ËûÃÇµÄ Web Ç°¶ËµÄ½Å±¾ÓïÑÔ£¬Èç½ñÔ½À´Ô½±»ÖØÊÓ£¬ËäÔòÈç´Ë£¬JavaScript
ÈÔȻӵÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔ Java ÃüÃû£¬µ«²¢²»ÊÇ Java
Ëü×î³õ½Ð Mocha£¬ ½ÓןÄà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ