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

//×Ô´øµÄ´òÓ¡Ô¤ÀÀ WebBrowser.ExecWB(1,1) ´ò¿ª  
Web.ExecWB(2,1) ¹Ø±ÕÏÖÔÚËùÓеÄIE´°¿Ú£¬²¢´ò¿ªÒ»¸öд°¿Ú  
Web.ExecWB(4,1) ±£´æÍøÒ³  
Web.ExecWB(6,1) ´òÓ¡  
Web.ExecWB(7,1) ´òÓ¡Ô¤ÀÀ  
Web.ExecWB(8,1) ´òÓ¡Ò³ÃæÉèÖà 
Web.ExecWB(10,1) ²é¿´Ò ......

ÇÉÓÃ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£¬µ¯³ö¸ö´°¿Ú£¬ÌáʾÈÃÊäÈëÊÖ»úºÅÂë¡£ÔÎËÀ£¬²»¾ÍÏÂÊ׸èÂ»¹²»ÈÃÖ±½ÓÏ¡£ºÇºÇ£¬·¢ÏÖÍ ......

JavaScriptÕýÔò±í´ïʽ

//УÑéÊÇ·ñÈ«ÓÉÊý×Ö×é³É 
function isDigit(s) 

var patrn=/^[0-9]{1,20}$/; 
if (!patrn.exec(s)) return false 
return true 

//УÑéµÇ¼Ãû£ºÖ»ÄÜÊäÈë5-20¸öÒÔ×Öĸ¿ªÍ·¡¢¿É´øÊý×Ö¡¢“_”¡¢“.”µÄ×Ö´® 
function isRegisterUserName(s)
{
v ......

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

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