Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click Event

Status
Not open for further replies.

Wheelz77

Technical User
Jan 25, 2007
13
Hi,

I'm told I can use a click event attached to a hyperlink to record pageload activity as it leaves my homepage.
I wish to know via my stat counter whether a visitor uses a hyperlink to visit another site or simply closes the browser and leaves.
At the moment it can only record pageloads within my own site.

I'm not Javascript savvy, but if someone could post an example I'm sure I can work through it.

Thanks all.
 
The general form is as follows:
Code:
<script>
//First define your function in a script block in the header
//of your document
function doSomeStuff(){
 alert("Hey, that tickles!");
}
</script>
Code:
<!-- Then you can set the onclick attribute of your link to
run the function -->
<a href="[URL unfurl="true"]http://www.somesite.com"[/URL] onclick="doSomeStuff()">Click Me</a>

Of course, what you should put in your doSomeStuff function depends on how you wanted your stat counter to record the action.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Enable Apps
 
Thanks dwarfthrower, I'll have a play with that and see if I can get it to do what I want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top