Matthew Bevan <[EMAIL PROTECTED]> writes:

> Useful.  I had a slightly different problem - I needed to display different
> "classes" of flash message - informational, warnings,  errors, or success.  To
> do so I use the following:

I pass the class together with the message.  My JS for that is below:

################################################################################
function displayStatusMessage(status, msg, timeout) {
    var msg = swapDOM('statusmessage', DIV({'id': 'statusmessage'},
        DIV({'class': status}, msg)));
    // Não defino o timeout no código, mas é interessante a implementação,
    // então mantive aqui.
    if (!timeout) { timeout=5 }
    if (timeout) {
        msg.hidecb = callLater(timeout, swapDOM, msg,
            DIV({'id': 'statusmessage'}, null));
    }
    connect(msg, 'onclick', function(e) {
        var msg = e.src();
        if (msg.hidecb) {
            msg.hidecb.cancel();
        }
        disconnect(msg);
        swapDOM(msg, DIV({'id': 'statusmessage'}, null));
        }
    );
}
################################################################################


-- 
Jorge Godoy      <[EMAIL PROTECTED]>

Attachment: pgpRI4MLCjvYR.pgp
Description: PGP signature

Reply via email to