Dialog schließen?

tsbmusic

Erfahrenes Mitglied
Hi Leute,

ich hab mir hier folgenden Code zusammengeschrieben:
Code:
Dialog = {
    setTitle: function(a){
        title = '<div class="dialog_title"><h2><span>'+a+'</span></h2>'+
                '<div class="dialog_close"><b>x</b></div></div>';
        return title;
    },
    setContent: function(a){
        return (typeof a == "string") ?
            '<div class="dialog_content">'+a+'</div>':
            '<div class="dialog_error">+a+</div>';
    },
    setBody: function(content){
        body = '<div class="dialog_body">';
        body += this.setContent(content);
        body += '</div>';
        return body;
    },
    close: function(obj){
        HTML.replace(obj,"");
    },
    showPrompt: function(title, content){
        dialog = '<div class="dialog">';
        dialog += this.setTitle(title);
        dialog += this.setBody(content);
        dialog += '</div>';
        HTML.addContent("body", dialog, 0);
        return this.close(dialog);
    },
    showMessage: function(title, content){
        return this.showPrompt(title, content);
    }

}

$(document).ready(function(){

    Dialog.showMessage("Willkommen", "Hallo Welt******", "");

});

Wie kann ich jetzt machen, dass wenn ich auf den .dialog_close Button klicke das this.close() ausgeführt wird? Aber es sollte schon irgendwie in das Dialog = {} mit eingebaut werden.

Gruss
tsbmusic
 

Neue Beiträge

Zurück