In the linkClick function you would use the if statement to check if clicks is 10, though I would play it safe and check if it’s greater than or equal to 10.
If it is, yo can then use window.location.href to specify the new URL.
<script type="text/javascript">
var clicks = 0;
function linkClick(){
document.getElementById('clicked').value = ++clicks;
if (clicks>3) {
window.location.href = "http://www.google.com/";
}
}
document.write('<a href="http://www.yahoo.com" onclick="linkClick()" target="_blank"><img src="img/site.png" alt=""></a>');
</script>
That works, but it only works with target=“_blank”. If I take the target blank off, it has a bit of a coronary. I think I have to find a way to add more javascript to make the link location a function. However, I am not a programmer – I’m just using the force here… I have done fairly well so far though, I think!