/    Sign up×
Community /Pin to ProfileBookmark

How to handle any links

i want to know who clicked on my links inside <div> tag./who = registered user/
i tryed following

[code=html]<script type=”text/javascript”>
function linkhandler(usr){
var TgVar = document.getElementsByTagName(‘a’)[0].onclick;
if(TgVar){
window.open(‘http://www.mysite.net/index.php?usr’);
//alert(TgVar);
}
}
</script>
<div onclick=”linkhandler(‘user name’);”>
<a>link</a>
<a>link</a>
<a>link</a>
<a>link</a>
</div>[/code]

Please help me

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@ryanlundAug 05.2009 — Where are you getting your user names from exactly? Anyways i guess its not important, however what i would do is use an ajax call to send the user data to a php script that saves it, in a file or a database, or whatever...

If you dont know anything about ajax look here:

http://www.w3schools.com/Ajax/Default.Asp

Or get jquery, it makes it easier than putting your socks on.

Hope i helped
Copy linkTweet thisAlerts:
@kaniauthorAug 05.2009 — i just want to get user information who clicked ads /without change link operation/.
Copy linkTweet thisAlerts:
@ryanlundAug 05.2009 — Yeah just use ajax to send the users information to your script and let the link carry on its usual job =)
×

Success!

Help @kani spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...