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

JavaScriptÖеĹ«ÓгÉÔ±£¬Ë½ÓгÉÔ±ºÍ¾²Ì¬³ÉÔ±

˽ÓгÉÔ±¾ÍÊÇÔÚÀàµÄÄÚ²¿ÊµÏÖÖпÉÒÔ¹²ÏíµÄ³ÉÔ±¡£µ«ÊDz¢²»¶ÔÍ⹫¿ª£¬JavaScriptÖв¢Ã»ÓÐÌØÊâµÄ»úÖÆÀ´¶¨Òå˽ÓгÉÔ±£¬µ«ÊÇ¿ÉÒÔÓÃһЩ¼¼ÇÉÀ´ÊµÏÖÕâ¸ö¹¦ÄÜ¡£Ö÷ÒªÊÇͨ¹ý±äÁ¿µÄ×÷ÓÃÓòÐÔÖÊÀ´ÊµÏֵģ¬ÔÚÒ»¸öº¯ÊýÄÚ²¿¶¨ÒåµÄ±äÁ¿³ÆΪ¾Ö²¿±äÁ¿£¬¸Ã±äÁ¿²»Äܱ»º¯ÊýÍâµÄ³ÌÐòËù·ÃÎÊ£¬¿ÉÒÔ±»º¯ÊýÄÚ²¿¶¨ÒåµÄǶÌ׺¯ÊýËù·ÃÎÊ¡£
ÔÚÀàµÄ¹¹Ô캯ÊýÖпÉÒÔΪÀàÌí¼Ó³ÉÔ±£¬Í¨¹ýÕâÖÖ·½Ê½¶¨ÒåµÄ³ÉÔ±£¬Êµ¼ÊÉϹ²ÏíÁËÔÚ¹¹Ô캯ÊýÄÚ²¿¶¨ÒåµÄ¾Ö²¿±äÁ¿£¬ÕâЩ±äÁ¿¾Í¿ÉÒÔ¿´×÷ÊÇÀàµÄ˽ÓгÉÔ±¡£È磺
ʵÏÖ˽ÓгÉÔ±
<script>
function class1(){
var pp="this is a private property";//˽ÓÐÊôÐÔ³ÉÔ±pp
function pm(){//˽Óз½·¨³ÉÔ±pm£¬ÏÔʾppµÄÖµ
      alert(pp);
}
this.method1=function(){//ÔÚ¹«ÓгÉÔ±Öиıä˽ÓÐÊôÐÔµÄÖµ
      pp="pp has been changed";
}
this.method2=function(){//ÔÚ¹«ÓгÉÔ±Öе÷ÓÃ˽Óз½·¨
     pm();
}
}
var obj1 = new class1();
obj1.method1();
obj1.method2();
</script>
×¢Ò⣺
¾Ö²¿±äÁ¿£¨Ë½ÓгÉÔ±£©±»ËùÓÐÔÚ¹¹Ô캯ÊýÖж¨ÒåµÄ¹«Óз½·¨Ëù¹²Ïí£¬¶øÇÒ½ö±»ÔÚ¹¹Ô캯ÊýÖж¨ÒåµÄ¹«Óз½·¨Ëù¹²Ïí£¬ÕâÒâζ×Å£¬ÔÚprototypeÖж¨ÒåµÄÀà³ÉÔ±²»ÄÜ·ÃÎÊÔÚ¹¹ÔìÆ÷Öж¨ÒåµÄ¾Ö²¿±äÁ¿¡£
ʵÏÖ¾²Ì¬³ÉÔ±£º
ºÍ˽ÓгÉÔ±ÃãÇ¿Ïà±È£¬¾²Ì¬³ÉÔ±¾ÍÒªÕýͳµÄ¶àÁË£¬¾²Ì¬³ÉÓï¾ÍÊÇÊôÓÚÒ»¸öÀàµÄ³ÉÔ±£¬È磺
function class1(){
}
class1.staticProperty="sample";
class1.staticMethod=function(){
         alert(class1.staticProerty);
}
class1.staticMethod();
Èç¹ûÒª¸øÿ¸öº¯Êý¶ÔÏó¶¼Ìí¼ÓͨÓõľ²Ì¬·½·¨£¬»¹¿ÉÒÔº¯Êý¶ÔÏóËù¶ÔÓ¦µÄÀàFunctionÀ´ÊµÏÖ£º
Function.prototype.showArgsCount=function(){
            alert(this.length);
}
function class1(a){
}
class1.showArgsCount();
Óɴ˿ɼû£¬Í¨¹ýFunctionµÄprototypeÔ­ÐͶÔÏ󣬿ÉÒÔ¸øÈκκ¯Êý¶¼¼ÓÉÏͨÓõľ²Ì¬³ÉÔ±¡£


Ïà¹ØÎĵµ£º

JavaScript ÑÕÉ«ÌݶȺͽ¥±äЧ¹û¸üÐÂ

½üÀ´¿´ÁËDeanµÄ“Convert any colour value to hex in MSIE”£¬ÖÕÓÚ½â¾öÁ˸ù¾Ý¹Ø¼ü×Ö»ñÈ¡ÑÕÉ«rgbÖµµÄÎÊÌâ¡£
˳±ã°Ñ³ÌÐòÒ²ÖØÐÂÕûÀíÒ»·¬£¬²¢Ê¹ÓÃÁË×î½üÕûÀíµÄ¹¤¾ß¿â¡£
Ч¹ûÔ¤ÀÀµ½ÕâÀï
ÏÂÔØÍêÕûʵÀý
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊǸù¾ÝÑÕÉ«¼¯ºÏºÍ½¥±ä¼¶ÊýÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
½¥±ä¼ ......

°´¶ÔÏó·½Ê½µ÷ÓÃjavascriptµÄÀý×Ó

 Ò³Ã棺
<script type="text/javascript" src="js/test.js"></script>
¡£¡£¡£¡£
<body onload="new myTest();" >
ÒÔ¶ÔÏó·½Ê½µ÷ÓÃÐèҪʹÓà new ²Ù×÷·û£¬test.jsµÄÄÚÈÝ:
{                  & ......

JavascriptÖÐ×î³£ÓõÄ55¸ö¾­µä¼¼ÇÉ ÊÕ²Ø

JavascriptÖÐ×î³£ÓõÄ55¸ö¾­µä¼¼ÇÉ ÊÕ²Ø
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 ......

JavaScript ¸´Ñ¡¿òµÄ·´Ñ¡

 
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>ÎÞ±êÌâÒ³</title>
<mce:script language="javascript" type="te ......

javascriptµÄdelete

¸Õ¸Õ°Ý¶ÁÁË JavascriptµÄ±äÁ¿Óëdelete²Ù×÷·û ºÜÊÜÆô·¢¡£Ô­ÎÄֻ˵Á˽á¹û£¬Ã»¸üÉîÈëÍÆÀí×ܽáÒ»ÏÂΪʲô£¬ÒÔ¼°ÔõôÀí½âºÃÒ»µã£¬ÎÒÕâÀï²¹³ä×ܽáһϡ£
 /// <reference path="http://tech.idv2.com/2008/01/09/javascript-variables-and-delete-operator/" />
/*
Óëc++²»Í¬£¬javascriptµÄdelete²»»áɾ³ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ