vendredi 29 mai 2015

How can I correctly close this JQuery dialog?

I am absolutly new in JavaScript and JQuery and I have the following problem.

Into a page I have this dialog:

<div id="dialogReject" title="">
    <table style="visibility: hidden;" id="rifiutaTable" border="0" class="standard-table-cls" style="width: 100%!important">
        <tbody style="background-color: #ffffff;">
            <tr>
                <td style="font: 16px Verdana,Geneva,Arial,Helvetica,sans-serif !important">Inserire note di rifiuto</td>
            </tr>
            <tr>
                <td>
                    <textarea style="visibility: hidden;" rows="5" cols="70" id="myRejectNote"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    <input class="bottone" readonly="readonly" type="text" value="Rifiuta" onclick="rifiuta()"/>
                </td>
            </tr>
        </tbody>
    </table>
</div>

that I think is created by this JQuery script:

$(document).ready(function() {
    larghezza = '950px';
    lunghezza = '470px';
    lunghezza2 = '530px';
    $("#dialogReject").dialog({
         autoOpen: false,
         //width:'335px',
         width:'600px',
         modal: true,
         show: {        
             effect: "blind",
             duration: 500      
         },
         hide: { 
             effect: "blind",   
             duration: 500    
         }
     });
});

As you can see this dialog contains 2 buttons implemented by 2 input tag, these:

<td style="text-align: right">
    <input class="bottone" readonly="readonly" type="text" value="Annulla" onclick="javascript:window.close()"/>

    <input class="bottone" readonly="readonly" type="text" value="Rifiuta" onclick="rifiuta()"/>
</td>

When the user click on the Annulla button I want that the dialog is closed.

Actually I tryied to use the window.close() function but it can't work.

I think that to cloe this dialog I have to use the same event that is performed when the user use the ESC keyboard button that close the dialog with a simple animation.

But I really have no idea about how do it. Can you help me to do it?

Tnx

Aucun commentaire:

Enregistrer un commentaire