+ -
当前位置:首页 → 问答吧 → 经常看到this.t = this.title;中this.t的t什么意思呢?

经常看到this.t = this.title;中this.t的t什么意思呢?

时间:2009-07-15

来源:互联网

经常看到this.title = this.t;中的t什么意思呢?

是属性还是?

作者: cnfi   发布时间: 2009-07-15

自定义的一个属性,可能是之前临时保存值得地方

作者: shawphy   发布时间: 2009-07-15

我仔细看了一下没有啊
this.tooltip = function(){
 /* CONFIG */
 xOffset = 10;
 yOffset = 20;
 // these 2 variable determine popup's distance from the cursor
 // you might want to adjust to get the right result
 /* END CONFIG */
 $("a.tooltip").hover(function(e){
  this.t = this.title;
  this.title = "";
  $("body").append("<p id='tooltip'>"+ this.t +"</p>");
  $("#tooltip")
   .css("top",(e.pageY - xOffset) + "px")
   .css("left",(e.pageX + yOffset) + "px")
   .fadeIn("fast");
  },
  function(){
   this.title = this.t;
   $("#tooltip").remove();
  });
 $("a.tooltip").mousemove(function(e){
  $("#tooltip")
   .css("top",(e.pageY - xOffset) + "px")
   .css("left",(e.pageX + yOffset) + "px");
 });
};
// starting the script on page load
$(document).ready(function(){
 tooltip();
});

我找的实例的网址是http://iinan.yo2.cn/articles/jquery-using-the-most-simple-to-use-the-mouse-across-the-tips-and-automatic-image-preview-2.html 最后一个例子

作者: cnfi   发布时间: 2009-07-15

 $("a.tooltip").hover(function(e){
  this.t = this.title;

这不就是么?

作者: shawphy   发布时间: 2009-07-15

这样都行?
那就是
this.a = null;都行??随便定义?

作者: cnfi   发布时间: 2009-07-17

t代表自定义的属性,而title是本身的属性吧。

作者: xyq159589   发布时间: 2009-07-17

引用
引用第4楼cnfi于2009-07-17 09:37发表的  :
这样都行?
那就是
this.a = null;都行??随便定义?

动态语言是可以随意添加属性的,只要对属性赋值,这个属性就存在了

作者: keakon   发布时间: 2009-07-17

相关阅读 更多