JavaScript中this关键字使用方法详解[7]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 applebbs 的 blog


    这里的this看作和1中的一样就可以了,它也使指代div元素对象实例本身。

    8、函数中的内部函数中使用this关键字:

  function outerfoo()
  {
      
this.name = 'outer name';
 
      
function innerfoo()
      {
          
var name = 'inner name'; 
          alert(name 
+ ', ' + this.name);
      }
      
return innerfoo;
  }
  outerfoo()();

本文关键:JavaScript中this关键字使用方法详解
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top