Overload Alert Function

Overloading the global alert function.

1
2
3
4
5
6
7
8
9
10
11
12
alert = (function () {
var console = document.createElement("div");
console.setAttribute("id", "console");
console.setAttribute("style", "width:300px; height:300px; font-family: monospace; font-size: 10px; border: 1px solid black; background: white; position: absolute; right: 0; top: 0; overflow: scroll;");
document.body.appendChild(console);
return function (s) {
var p = document.createElement("p");
p.appendChild(document.createTextNode(s));
console.appendChild(p);
p.scrollIntoView();
}
})();
Share