Add

点出统计器[原创]


这个程序可以用 <script src="clickout.js"></script> 加到任意页面的 </body> 前面。

当用户点击 a 标签时触发事件

/*
 * 说明:点出统计器
 * 作者:邓威
 * 日期:2006-07-25
 * 版本:v1.2
 */
document.write(‘<div id="ClickOut" style="width:0px;height:0px;"></div>’);
function ClickOut()
{
 this.oCO  = null;
 this.src_onclick = null;
 this.isDEBUG  = true || "status";
 this.isOP  = (navigator.appName + " " + navigator.appVersion);
 this.isOP  = (this.isOP.indexOf(‘Opera’)>-1?true:false);

 this.  = function(arg) {
  if( this.isDEBUG == "status" ) window.status = arg.toString();
  else if ( this.isDEBUG ) alert(arg.toString());
 }

 this.save  = function() {
  var IOUT = "";
  // GET 方式接收数据的页面
  var sUrl = "http://www.xxx.com/" + "clickout.?";

  try
  {
   if( Traffic_Counter.IOUT )
   {
    IOUT = Traffic_Counter.IOUT;
   }
   else
   {
    IOUT = "";
   }
  }
  catch(e)
  {
   IOUT = "";
  }
  sUrl += "IOUT=" + encodeURIComponent(IOUT);
  sUrl += "&src=" + encodeURIComponent(this.click_src);
  sUrl += "&text=" + encodeURIComponent(this.click_text);
  this.addins(sUrl);
  return true;
 }

 this.addins  = function(sUrl) {
  var code;
  
  if( !this.isOP )
  {
   code = ‘<img src="’ + sUrl + ‘" style="display: none;" width="0px" height="0px" \/>’;
  }
  else
  {
   code = ‘<iframe width="0" height="0" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" src="’ + sUrl + ‘"><\/iframe>’;
  }
  document.getElementById("ClickOut").innerHTML =  code;
  this.debug("已发送请求");
  return true;
 }

 this.onclick  = function(evt) {
  if( evt == null ) evt = window.event; // For FF
  if( this.src_onclick != null ) this.src_onclick(evt);
  
  var obj = evt.srcElement ? evt.srcElement : evt.target ; // For FF
  var tag = obj.tagName.toLowerCase();
  
  if( tag != "a" ) return;

  this.click_tag  = tag;
  this.click_src  = obj.href;
  this.click_text  = obj.innerHTML;
    
  this.debug(this.click_path);
  objClickOut_doSave();
 }

}

// 实例
var objClickOut = new ClickOut();
// 保存原有的 onclick 事件
objClickOut.src_onclick = document.onclick;

function objClickOut_click_tmp(evt) {
 objClickOut.onclick(evt);
}
function objClickOut_doSave() {
 objClickOut.save();
}

// bind event
document.onclick = objClickOut_click_tmp;

 

Random Posts Recent Comments

  • Nouramohsen88 Says:

    http://goo.gl/vFWge لدينا ثلاجات عرض جديدة ومستعملة للبيع ولدينا ثلاجات عرض سوبر ماركت وحلويات في ست...

  • Nouramohsen88 Says:

    http://www.drdrahem.com/home دكتور رجيم دكتور تخسيس الكرش والارداف مركز تخسيس في مدينة نصر ...

  • Nouramohsen88 Says:

    شركه تصنيع صاعق ناموس http://www.grandelectronic-eg.com/...

  • Nouramohsen88 Says:

    شركة كشافات اضاءة في مصر http://www.grandelectronic-eg.com/ ...

  • Nouramohsen88 Says:

    http://www.grandelectronic-eg.com/ شركة كشافات طواريء في مصر...

  • Nouramohsen88 Says:

    anti-mosquitocompany.blogspot.com شركة جراند الكترونيك هي شركة مصرية متخصصة في تصنيع الكشافات الكهرب...

  • Nouramohsen88 Says:

    insect--killer.blogspot.com شركة جراند الكترونيك هي شركة مصرية متخصصة في تصنيع الكشافات الكهربية وك...

  • Nouramohsen88 Says:

    http://genius-square.com/ شركه للتدريب والاستشارات | متخصصون في التنمية البشرية...

  • Er Says:

    我了个去,我也是用的phpo ..... 看来大家的思绪差不多。。。。...

  • Fasf Says:

    SYM_TYPE * pType;改为SYM_TYPE pType;...

Tag Cloud

arm audio blog brew cache class debug flash google html j2me java javascript Joke linux lua mobile mtk php python ror ruby server shell stream unix web windows 优化 动态加载 女人 女生 平台 开发 手机 技术 流媒体 测试 漫画 生活 男人 男生 缓存 芯片