How to beg

dog begging

I provide some free open source software, and to help defray the costs of this website, I usually beg for PayPal donations.

Here’s a JavaScript function I use, attached to the download link, to annoy people into sending me a donation:

function begForMoney()
  if (!arguments.callee.stopBegging) {
    arguments.callee.stopBegging = true;
    alert("Please donate!");

Here’s how to attach it to a link. You can attach it to multiple links on the page, and it only triggers an alert the first time it is clicked.

<a href="" onclick="begForMoney()">Download</a>

2 Responses to “How to beg”

  1. Marty says:

    Why all the extra code, just to onclick=alert() ?

  2. pat says:

    It checks to see if the alert has already been performed on this page. This allows me to add begForMoney() onto multiple links while preventing the alert from getting too annoying.

Leave a Reply