call onclick attribute programmatically

First of all, the ID attribute has some restrictions, one being that it must start with a letter. After you fix that, I would recommend not using an inline onclick handler.

$("#ID_HERE").click(function(e) {
  fnaaa();
  e.preventDefault();
});

Then you can trigger it easily:

$("#ID_HERE").triggerHandler("click");

However, if you absolutely must use the ugly onclick, you can invoke it like this:

<a id="foo" href="#" onclick="alert('test');">Test</a>
var el = document.getElementById('foo');
el.onclick();

You are using onclick attribute to bind the handler. Try like below,

document.getElementById(id).click();

DEMO: http://jsfiddle.net/kpvKG/