using Javscript on a webpage

Javascript's primary reason to exist was to allow website developers to execute behaviors based on user input, like clicking.

Events are bound to objects using handlers like “onclick()”, “onhover()”, etc. and are typically embedded on the page, or in an external .js file

Following will cause an alert when clicked, and prevent returning so you don't actually follow the link:

click me

The code:

<a href="#" onclick="alert('thanks for the click'); return false;">click me</a>

More complex logic can be achieved in similar fashion:

It's advisible to look into using a Javascript library like jQuery or Prototype when things start getting hairy! Save yourself some typing.

Next: Installing Greasemonkey (and other useful extensions)