. You simply write your script in the link's in-line onclick event handler:

<A HREF="page2.asp"
   ONCLICK="window.location.replace(this.href); return false">
  Page 2
</A>

this link.