Get Programming with JavaScript - Listing 17.11

Listing 17.11 - A web-based message view

CSS:

(function () { "use strict"; function renderMessage (message) { return "*** " + message + " ***"; } function render (message) { var messageDiv = document.getElementById("messages"); messageDiv.innerHTML = renderMessage(message); } function clear () { var messageDiv = document.getElementById("messages"); messageDiv.innerHTML = ""; } if (window.theCrypt === undefined) { window.theCrypt = {}; } theCrypt.messageView = { render: render, clear: clear }; })();