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

javascript ÖÐthis µÄÓ÷¨:

javascript ÖÐthis µÄÓ÷¨:
1.<div onclick="// ¿ÉÒÔÔÚÀïÃæʹÓÃthis">division element</div> this Ö¸Ïòdiv
2.    <div id="elmtDiv">division element</div>
       <script language="javascript">
        var div = document.getElementById('elmtDiv');
        div.attachEvent('onclick', EventHandler);  //attachEvent°ÑdivµÄonclickʼþºÍÒ»¸ö·½·¨°ó¶¨
         function EventHandler()
         {
         // ÔÚ´ËʹÓÃthis
          }
        </script>ÔÚ´Ëthis Ö¸Ïòwindow¶ÔÏó,ÈôÒªÒýÓÃdiv¶ÔÏóthis.event.srcElement;
3¡¢ÓÃDHTML·½Ê½ÔÚʼþ´¦Àíº¯ÊýÖÐʹÓÃthis¹Ø¼ü×Ö£º
<div id="elmtDiv">division element</div>
 <script language="javascript">
 var div = document.getElementById('elmtDiv');
 div.onclick = function()
 {
    // ÔÚ´ËʹÓÃthis
 };
 </script>²úÉúµÄ·½·¨Í¬ÉÏ,µ«´Ë´¦µÄthis Ö¸Ïòdiv
4¡¢ÀඨÒåÖÐʹÓÃthis¹Ø¼ü×Ö£º
function JSClass()
  {
      var myName = 'jsclass';
      this.m_Name = 'JSClass';
  }
  JSClass.prototype.ToString = function()
  {
      alert(myName + ', ' + this.m_Name);
  };
  var jc = new JSClass();
  jc.ToString();//ÕâÊÇJavaScriptÄ£ÄâÀඨÒåÖжÔthisµÄʹÓã¬Õâ¸öºÍÆäËüµÄOOÓïÑÔÖеÄÇé¿ö·Ç³£µÄÏàʶ¡£µ«ÊÇÕâÀïÒªÇó³ÉÔ±ÊôÐԺͷ½·¨±ØÐëʹÓÃthis¹Ø¼ü×ÖÀ´ÒýÓã¬ÔËÐÐÉÏÃæµÄ³ÌÐò»á±»¸æÖªmyName䶨Òå¡£
5¡¢Îª½Å±¾ÒýÇæÄÚ²¿¶ÔÏóÌí¼ÓÔ­Ðη½·¨ÖеÄthis¹Ø¼ü×Ö£º
Function.prototype.GetName = function()
  {
      var fnName = this.toString();
      fnName = fnName.substr(0, fnName.indexOf('('


Ïà¹ØÎĵµ£º

JavaScriptµÄ±Õ°ü


   ±Õ°ü£º
    ECMAScriptÖ§³Ö±Õ°ü¡£Ëùν±Õ°ü£¬¾ÍÊǺ¯ÊýÄÜʹÓú¯ÊýÍⶨÒåµÄ±äÁ¿¡£
    var iBaseNum = 10;
    function addNumbers(iNum1, iNum2)
    {
        function doAddition()
   ......

javascriptÕýÔò±í´ïʽʵÏÖtrim()ÒÉ»ó

ÕýÔÚ¿´¡¡javascript¸ß¼¶³ÌÐòÉè¼Æ¡¡,ÆäÖйØÓÚ·Ö×éÀïÃæµÄÒ»¾ä´úÂë²»ÊÇÌ«Àí½â:
ͨ¹ýÅäºÏʹÓÃString¶ÔÏóµÄreplace()·½·¨¼°·´ÏòÒýÓ㬾ͿÉÒÔ¶¨Òå×Ô¼ºµÄtrim()·½·¨:
String.prototype.trim = function() {
var reExtraSpace = /^\s+(.*?)\s+$/;
return this.replace(reExtraSpace,"$1");
}
 
Ò»¿ªÊ¼ÔõôҲ²» ......

È«ÃæÀí½âjavascriptµÄcaller,callee,call,apply¸ÅÄî

Arguments
¸Ã¶ÔÏó´ú±íÕýÔÚÖ´Ðеĺ¯ÊýºÍµ÷ÓÃËüµÄº¯ÊýµÄ²ÎÊý¡£
[function.]arguments[n]
²ÎÊý
function £ºÑ¡Ïî¡£µ±Ç°ÕýÔÚÖ´ÐÐµÄ Function ¶ÔÏóµÄÃû×Ö¡£
n £ºÑ¡Ïî¡£Òª´«µÝ¸ø Function ¶ÔÏóµÄ´Ó0¿ªÊ¼µÄ²ÎÊýÖµË÷Òý¡£
˵Ã÷
ArgumentsÊǽøÐк¯Êýµ÷ÓÃʱ£¬³ýÁËÖ¸¶¨µÄ²ÎÊýÍ⣬»¹ÁíÍâ´´½¨µÄÒ»¸öÒþ²Ø¶ÔÏó¡£ArgumentsÊÇÒ»¸öÀàËÆ ......

9 ¸ö»ùÓÚJavaScript ºÍ CSS µÄ Web ͼ±í¿ò¼Ü


      jQuery, MooTools, Prototype µÈÓÅÐãµÄ
JavaScript ¿ò¼ÜÓµÓи÷ÖÖÇ¿´óµÄ¹¦ÄÜ£¬°üÀ¨»æÖÆ Web ͼ±í£¬Ê¹ÓÃÕâЩ¿ò¼ÜÒÔ¼°ÏàÓ¦²å¼þ£¬ÎÒÃÇ¿ÉÒԷdz£ÇáËɵØʵÏÖÇúÏßͼ£¬Ô²±ýͼ£¬Öù״ͼµÈ
Web ͼ±íµÄ»æÖÆ£¬¶ø²»±ØÏóÒÔÍùÄÇÑùͨ¹ý¸´Ô Flash ¼¼ÊõʵÏÖ¡£±¾ÎĽéÉÜÁË9¸öÓÅÐãµÄ»ùÓÚ JavaScript Óë CSS& ......

JavaScriptÄÚÖöÔÏóÊôÐÔ¼°·½·¨

1.Date
ÊôÐÔ(1):
constructor      Ëù½¨Á¢¶ÔÏóµÄº¯Êý²Î¿¼
prototype       Äܹ»Îª¶ÔÏó¼ÓÈëµÄÊôÐԺͷ½·¨
·½·¨(43):
getDay()        ·µ»ØÒ»ÖÜÖеĵڼ¸Ìì(0-6)
getYear()       ·µ»ØÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ