When element is clicked, someFunction is fired. Inside someFunction, I have this bit of code:

var theid = this.getAttribute('id');

which retrieves the id of someElement.

So far so good but...

I would like to be able to use someFunction not only as the result of an onclick event. For example, I'd like to use it like that:

someFunction('the-id-hard-typed');

Obviously, it wouldn't work since someFunction does not receive any argument. So I thought modify my code to like that:

someElement.onclick = someFunction(this.getAttribute('id'));

But... it doesn't work...

I would like to know how I can pass an argument to someFunction when it is the result of my onlick event so I can also use someFunction() without having to clone it (and change its name slightly) just so it can receive an argument.