I'd like to execute a Javascript function `myFunc(myParam)` automatically when a HTML link is opened, how can I achieve this without breaking compatibility with current browsers?

Notes:

* Function name is static whereas parameter is passed dynamically for each link.
* I've seen similar questions on SO but personally I would prefer not to use any JS library (if possible), but just my own code