How to call a button via javascript in xpage?

How can I call a button on a XPage to work from JavaScript (for example on a onclick event)?

In case I would try:

dojo.byId(”#{javascript:getClientId(’refreshnow_button’)}”).click()

the id (or name) of the button will change at rendiering.

what is the proper way?

Subject: answer

HiNo need to write javacript.

The correct format is

dojo.byId(“{id:fieldName}”);

and this is for CSJS.