I see that you flagged the question using jQuery, which is a great way to do this, as Kerry suggested.
With jQuery, this is very simple:
$("#paypalLink").click(function(){ $(".loading").show(); }
And your html will look like this
<a href="http://paypal.com/whateverelse" id="paypalLink">Pay with Paypal</a> <img src="loading.gif" class="loading" />
You will hide the “load” class in your CSS when the page loads (possibly with a display: none;) and then show it with jquery.
There are several ways to do this, just take this as a starting point.
For jQuery click api go here => http://api.jquery.com/click/
source share