All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
php语言中switch的用法介绍_[PHP教程]
Cake:让PHP也跑在铁轨上_php资料_编程技术
Delphi项目的框架类-TApplication类实例-详解
手把手教你制作vs2005装饰_[Asp.Net教程]
Asp.Net2.0数据库基本操作方法学习_[Asp.Net教程]
SQL,Server,最佳实践分析器使用小结_[SQL,Server教程]
在Web2.0下的十大AJAX安全漏洞以及成因_.net资料_编程技术
通过PHP连接MYSQL数据库、创建数据库、创建表_[PHP教程]
C#文件处理技术:文件的读取使用方法
应用实例:用javascript实现定时任务_JavaScript技术_编程技术
Reading number is top 10 pictures
Summer is most suitable for young people to travel in China1
The world's top ten most beautiful railway station1
A man's favorite things1
运动的范冰冰3
The cat shit
开始让人感动,后来......
美奂绝伦的风景
Angie Chiu vijara myth1
Ashlynn Brooke a group sexy photo1
性感丰满身材火爆de美女2
Download software ranking
Unix video tutorial3
Professional killers2 data package
Boxer's Top ten classic battle4
Eclipse-CALMSANNY (second edition)
Tram sex maniac 2 (H) rar bag2
I'm come from Beijing2
尖东毒玫瑰B
Unix video tutorial19
Photoshop 8.0图象编辑软件
linux初级教程
delv published in(发表于) 2013/12/31 6:35:04 Edit(编辑)
javascript应用实例:点出统计器_JavaScript技术_编程技术

javascript应用实例:点出统计器_JavaScript技术_编程技术

javascript应用实例:点出统计器_JavaScript技术_编程技术-你的首页-uuhomepage.com







ff   默认不让改 status
opera9 测试通过
ie6   测试通过




这东西是给统计部门用的,分析用户习惯以改良网站布局。
只是写着玩的小东西,所以很多地方不太理想。




save() 方法是保存记录的,没仔细做,应该再加个判断浏览器,然后决定用 img 还是 iframe,以保证 request 一定能发出去.
onclick() 方法是触发事件时执行的




使用方法:




在任意页面中加入




CODE:
script src="clickout.js">




最好是放在 前面,目的是防止 onclick 事件覆盖。




clickout.js







CODE:




/*
* 说明:点出统计器
* 作者:邓威
* 日期:2006-07-25
* 版本:v1.0
*/




function ClickOut()
{
this.oCO = null;
this.src_onclick = null;
this.isDEBUG = true || "status"; // 改成 this.isDEBUG = "status"; 就可以在 window.status 里显示了




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




this.save = function() {
var sUrl = "clickout.php?";
sUrl += "tag=" + encodeURIComponent(this.click_tag);
sUrl += "&type=" + encodeURIComponent(this.click_type);
sUrl += "&src=" + encodeURIComponent(this.click_src);
sUrl += "&text=" + encodeURIComponent(this.click_text);
this.oCO = document.createElement('



');
document.body.appendChild(this.oCO);
document.getElementById("ClickOut").innerHTML = '';
return true;
}




this.onclick = function(args) {
if( this.src_onclick != null ) this.src_onclick(e);
var obj = event.srcElement;
var tag = obj.tagName.toLowerCase();

this.click_id = obj.id?obj.id:null;
this.click_class = obj.className?obj.className:null;
this.click_name = obj.name?obj.name:null;
this.click_tag = tag;
this.click_parent = obj;
this.click_obj = obj;
this.click_path = tag;




if( tag == "a" ) {
this.click_type = "text";
this.click_src = obj.href;
this.click_text = obj.innerHTML;
}
else if ( tag == "img" ) {
this.click_type = "pic";
this.click_src = obj.src;
this.click_text = obj.alt;
}
else if ( tag == "font" || tag == "b" || tag == "strong" ) {
this.click_type = "text";
this.click_src = "";
this.click_text = obj.innerHTML;
}
else {
this.click_type = "layer";
this.click_src = "" ;
this.click_text = obj.innerHTML;
}

this.GetParent();




this.debug(this.click_path);
doSave();
}




this.GetParent = function() {
if( !this.click_parent.parentNode.tagName ) return;
this.click_parent = this.click_parent.parentNode;
this.click_path = this.click_parent.tagName.toLowerCase() + "[ " +
(this.click_parent.id?("ID:" + this.click_parent.id):"") +
(this.click_parent.className?(" ,CLASS:" + this.click_parent.className):"") +
(this.click_parent.name?(" ,NAME:" + this.click_parent.name):"") +
" ]" + ">" + this.click_path;
this.GetParent();
}
}




// 实例
var objCO = new ClickOut();
objCO.src_onclick = document.onclick;




function click_tmp() {
objCO.onclick();
}
function doSave() {
objCO.save();
}




// bind event
document.onclick = click_tmp;







演示:




运行代码框







[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]






















添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.