Ora non ho accesso al server.
Ho preparato gli script per le altre 2 sintassi.
Sarebbero sintatticamente corrette scritte in questo modo?

codice:
function ChoosePharmacy()
{


(async function() {


    //statements before showing a modal dialog


    var result = window.showModalDialog('search_pharmacy.aspx',window,"dialogWidth:800px;dialogHeight:600px;scroll: no;")


    if (result!=null)


        document.getElementById('hIdPharmacy').value=result;


    //statements after closing a modal dialog


})();
}

e

codice:
function ChoosePharmacy()
{


(function() {


    //statements before showing a modal dialog


    var result = window.showModalDialog('search_pharmacy.aspx',window,"dialogWidth:800px;dialogHeight:600px;scroll: no;")


    if (result!=null)


        document.getElementById('hIdPharmacy').value=result;


    //statements after closing a modal dialog


})();
}
La mia funzione di partenza è la solita qua sotto:

codice:
function ChoosePharmacy()
{
    var result = window.showModalDialog('search_pharmacy.aspx',window,"dialogWidth:800px;dialogHeight:600px;scroll: no;")


    if (result!=null)


        document.getElementById('hIdPharmacy').value=result;


}

che è agganciata al OnClick() del button.