|
ff 北京网页设计默认不让改 status网站制作 opera9 测试通过网页设计 ie6 测试通过
这东西是给统计部门用的,分析用户习惯以改良网站布局。北京网站建设 只是写着玩的小东西,所以很多地方不太理想。
save() 方法是保存记录的,没仔细做,应该再加个判断浏览器,然后决定用 img 还是 iframe,以保证 request 一定能发出去.网站设计 onclick() 北京网站建设方法是触发事件时执行的
使用方法:
在任意页面中加入
CODE:北京网站建设 script src="clickout.js"></script>
最好是放在 </body> 前面,目的是防止 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) {www.qitongnet.com 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('<div id="ClickOut" style="width:0px;height:0px;"></div>');www.qitongnet.com document.body.appendChild(this.oCO); 企通互联 document.getElementById("ClickOut").innerHTML = '<img src="' + sUrl + '" style="display: none;" width="0px" height="0px" \/>';www.qitongnet.com 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" ) {www.qitongnet.com 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;www.qitongnet.com this.click_text = obj.alt;北京网站制作 }www.qitongnet.com else if ( tag == "font" || tag == "b" || tag == "strong" ) {网站设计 网站建设 this.click_type = "text";北京网站制作 this.click_src = "";www.qitongnet.com this.click_text = obj.innerHTML;网站设计 }网站建设 else {www.qitongnet.com this.click_type = "layer";网站制作 this.click_src = "" ; 网站制作网站设计 this.click_text = obj.innerHTML;网站设计 www.qitongnet.com }企通互联 网站设计北京网站设计 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; www.qitongnet.com 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 全部选择 提示:你可先修改部分代码,再按运行] |