Hello,

I want to make a small link tracking utility for my sites. My idea is that I use AJAX and call the tracking script on the onmouseup event of the <a> tag.
(The onclick doesn't work if the visitor clicks with the middle button and the onmousedown just make nothing, I mean the link will not be opened.)

So I put the javascript call in onmouseup event:
Code:
<a href="http://www.mypartner.com/" target="_blank" onmouseup="doWork(this);">My Partner</a>
And my tracking function is the following:
Code:
		function setOutput(){
			return true;
		}

		function doWork(element){
			httpObject = getHTTPObject();
			if (httpObject != null) {
				dst = element.href;
				src = document.location.href;
				httpObject.open("GET", "http://www.zzz.com/ccount.php?src="+src+"&dst="+dst, true);
				httpObject.send(null);
				httpObject.onreadystatechange = setOutput;
			}
		}
The code above works fine if the user clicks on a link on site zzz.com
However if user clicks a link on yyy.com then it doesn't work anymore.

When I debug it on zzz.com then the doWork finishis it's run (executes the ccount.php correctly) and the browser opens the link. However if I debug it on site yyy.com then the doWork function will not be finished, but when httpObject.open is called it just opens the link in the browser immediately and ccount.php is not executed at all.

Don't forget that in both cases I want to call the ccount.php on zzz.com.

Any idea how to solve this problem, or maybe a better solution?

Thanks in advance!