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

  ½ñÌìÔÚµ÷ÊÔJavaScript³ÌÐò£¬Í»È»·¢ÏÖÍüÁ˵¥ÒýºÅºÍË«ÒýºÅµÄÇø±ðÊÇʲôÁË£¬ÓÚÊǺõÉÏÍøËÑË÷Ö®£¬¼ÓÉÏ×Ô¼ºµÄµ÷ÊÔ£¬×îÖÕ·¢ÏÖÔ­À´ÊÇÊéÉÏдµÄ³ö´íÁË¡£NND¸öÐÜ£¬ÈÃÎÒ¶ÔÕâÊéʧÍû¼«ÁË¡£·Ï»°²»Ëµ£¬Ö±±¼Ö÷Ìâ¡£
  JavaScript²»Çø·Öµ¥¸ö×Ö·ûºÍ×Ö·û´®£¬ÈκÎ×Ö·û»ò×Ö·û´®¿ÉÒÔÓÃË«ÒýºÅ»òµ¥ÒýºÅÒýÆðÀ´¡£Èç¹û×Ö·û´®±¾Éíº¬ÓÐË« ......

javascript typeofµÄÓ÷¨

  ÔÚjsÀïÓõ½Êý×é,±ÈÈç ¶à¸öÃû×ÖÏàͬµÄinput, ÈôÊǶ¯Ì¬Éú³ÉµÄ, Ìύʱ¾ÍÐèÒªÅжÏÆäÊÇ·ñÊÇÊý×é.
if(document.mylist.length != "undefined" ) {} Õâ¸öÓ÷¨ÓÐÎó.
ÕýÈ·µÄÊÇ if( typeof(document.mylist.length) != "undefined" ) {}
»ò if( !isNaN(document.mylist.length) ) {}
typeofµÄÔËËãÊý䶨Òå,·µ»ØµÄ¾ÍÊÇ "un ......

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

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

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²Ù×÷ÏÂÀ­¿òµÄ³£Ó÷½·¨

Ô­ÎÄ£ºÁõÎä
| Javascript²Ù×÷ÏÂÀ­¿òµÄ³£Ó÷½·¨
ÏîÄ¿ÖÐÅöµ½ÐèÒªÓÃjavascript²Ù×÷ÏÂÀ­¿òµÄÇé¿ö£¬Ë³±ã×öÒ»ÏÂ×ܽᣬÁгöһЩ³£Ó÷½·¨£¬ÒÔÏ·½·¨¾ùÔÚFIRFOX3.5¼°IE8ÉϲâÊÔ¹ý£¬ÈçÓÐÆäËûä¯ÀÀÆ÷ÎÞ·¨Õý³£ÔËÐеÄÇëÓë±ÊÕßÁªÏµ¡£
//Ìí¼ÓÒ»¸öÏÂÀ­¿ò
function AddDropDownList(id,fatherCtl)
{
if(!document.getElementById(id) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ