Login   Register  
PHP Classes
elePHPant
Icontem

File: click-tale.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Frederik Yssing  >  Click-tale  >  click-tale.js  >  Download  
File: click-tale.js
Role: Auxiliary data
Content type: text/plain
Description: the javascriptfile.
Class: Click-tale
Track user clicks on pages and show a click graph
Author: By
Last change: bug fixed
Date: 2012-05-26 08:33
Size: 642 bytes
 

Contents

Class file image Download
// set-up to use onclick 
document.onclick = getClickXY;

var IE = document.all?true:false

function getClickXY(e){
	var tempX = 0;
	var tempY = 0;
	if (document.captureEvents) {
		var loc = window.location.pathname;
		if (IE) { // grab the x-y pos.s if browser is IE
			tempX = event.clientX + document.body.scrollLeft;
			tempY = event.clientY + document.body.scrollTop;
			scrollval = $(window).scrollTop();
		} else {  // grab the x-y pos.s if browser is NS
			tempX = e.pageX;
			tempY = e.pageY;
		} 	

		$.get('click-tale.php?x='+tempX+'&y='+tempY+'&url='+loc, function(data) {
			//alert(data);		
		});			
	}	
}