Search

6/05/2006

利用Javascript對用戶端資訊的蒐集

http://qtutu.com/blog/?p=11
http://www.chedong.com/tech/click.html


/* (C) 2003 - 2004 www.chedong.com

* Free for all users, but leave in this header

* click based user analysis:
* usage: touch a empty click.gif or create a static page on at server
* including following script into your html page
*/

document.onclick = clickStat;

function clickStat() {
// create a new empty element
var image = document.createElement("<img src="" />");

// record client screen size and mouse coordinate
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
image.src = "http://www.chedong.com/click_stats.php?width=" + screen.width + "&x="
+ tempX + "&amp;y=" + tempY;
image.height = 0;
image.width = 0;

//send request to stat server
document.body.insertBefore(image);
return true;
}

沒有留言: