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

Javascript ÃæÏò¶ÔÏó»úÖƵÄʵÏÖ

Javascript ÃæÏò¶ÔÏó»úÖƵÄʵÏÖ
×Ô¶¨ÒåÀàµÄʵÏÖ·½·¨ºÜ¶à£¬Öصã̸Á½ÖÖ¡£
¹¹Ô캯Êý·¨
function Player(url){
    this.url = url;
   
    this.showUrl = function(){
        alert(this.url);
    }
   
    this.play = function(){
        // do play
    }
}
var myPlayer = new Player("test.mp3");
myPlayer.showUrl();
alert(myPlayer instanceof Player);
Óŵ㣺Àà±»·â×°³ÉÒ»¸öÕûÌå ÉùÃ÷ʵÀýÓÃnewÔËËã·û
ȱµã£º¶ÔÏóµÄ·½·¨»áÖظ´Éú³É
function Player(url){
   this.url = url;
   if(typeof Player._initialized == "undefined"){
      Player.prototype.showUrl = function(){
         alert(this.url);
         Player._initialized = true;
      }
   }
}
var myPlayer = new Player("test.mp3");
myPlayer.showUrl();
alert(myPlayer instanceof Player);
Óŵ㣺±ÜÃâÁ˺¯ÊýµÄÖظ´´´½¨
ȱµã£ºÂé·³Ò»µã
·ÃÎÊȨÏÞ
JavaScript ±¾Éí²¢Ã»·¨Çø·Ö˽ÓбäÁ¿ºÍ¹«¹²±äÁ¿£¬Í¨³£ÔÚÃüÃûÉÏÇø·Öһϣ¬Ò»°ãÏ°¹ßÔÚ˽ÓбäÁ¿µÄÇ°¼ÓÒ»¸öÏ»®Ïß this._privateProperty¡£
ÓÐvarÉùÃ÷µÄ¾Ö²¿±äÁ¿¿ÉÒÔµ±×÷˽ÓбäÁ¿£¬thisÒýµ¼µÄΪ¹²ÓжÔÏó¡£
ʼþ
function Player(url){
   this.url = url;
   var self = this;
   var position;
   this.onPositionChange = null; // ʼþ¶¨Òå
   this.setPosition = function(value){
      self.position = value;
      if (this.onPositionChange)
         this.onPositionChange(this); //ʼþ´¥·¢
   }
}
   var myPlayer = new Player("test.mp3");
   myPlayer.onPositionChange = function fun(obj){ //ʼþ¶©ÔÄ
   alert(obj.position + 's Position Change');
}
myPlayer.setPosition(100);
ʵÀý»¯
¿É


Ïà¹ØÎĵµ£º

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£º¶þ¡¢»Ø¹é¼òµ¥

ÒýÑÔ
 
ÒªÀí½â JavaScript£¬ÄãµÃÊ×ÏÈ·Å϶ÔÏóºÍÀàµÄ¸ÅÄ»Øµ½Êý¾ÝºÍ´úÂëµÄ±¾Ô­¡£Ç°Ãæ˵¹ý£¬±à³ÌÊÀ½çÖ»ÓÐÊý¾ÝºÍ´úÂëÁ½ÖÖ»ù±¾ÔªËØ£¬¶øÕâÁ½ÖÖÔªËØÓÖÓÐמÀ²ø²»ÇåµÄ¹Øϵ¡£JavaScript¾ÍÊÇ°ÑÊý¾ÝºÍ´úÂ붼¼ò»¯µ½×îԭʼµÄ³Ì¶È¡£
 
»ù±¾ÀàÐÍ
Ò»¡¢¼òµ¥Êý¾ÝÀàÐÍ£ºundefined¡¢null¡¢boolean¡¢number¡¢string£¨×¢Ò⣺¶¼Ê ......

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£ºÊ®¡¢Ô­ÐÍÀ©Õ¹

ÒýÑÔ
 
Ïë±Ø¾ýµÄÎòÐÔ¼«¸ß£¬¿ÉÄÜÄã»áÕâÑùÏ룺Èç¹ûÔÚJavaScript ÄÚÖõÄÄÇЩÈçObject ºÍFunctionµÈº¯ÊýµÄprototypeÉÏÌí¼ÓЩеķ½·¨ºÍÊôÐÔ£¬ÊDz»ÊǾÍÄÜÀ©Õ¹JavaScriptµÄ¹¦ÄÜÄØ£¿
    ÄÇô£¬¹§Ï²Ä㣬ÄãµÃµ½ÁË£¡
 
±Õ°üÄ£ÐÍ
 
<script language="javascript">
function person(){& ......

Javascript[ת]


<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......

JavaScript¾«´â¶ÁÊé±Ê¼Ç(8)

µÚ8Õ  ·½·¨
JavaScript°üº¬ÁËÉÙÁ¿¿ÉÓÃÔÚ±ê×¼ÀàÐÍÉϵıê×¼·½·¨¡£
Array
array.concat(item…)
concat·½·¨·µ»ØÒ»¸öÐÂÊý×飬Ëü°üº¬arrayµÄdz¸´ÖÆ(shallow copy)²¢½«1¸ö»ò¶à¸ö²ÎÊýitem¸½¼ÓÔÚÆäºó¡£Èç¹û²ÎÊýitemÊÇÒ»¸öÊý×飬ÄÇôËüµÄÿ¸öÔªËػᱻ·Ö±ðÌí¼Ó¡£´ËÍ⣬Çë²Î¼û±¾ÕºóÃæµÄarray.push(item…)·½·¨¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ