function () {
var i = 0,
r = function (n) {
return Math.floor(Math.random() * n)
},
f = document.getElementsByTagName('body')[0].getElementsByTagName('*'),
o = function (e) {
return typeof(e.style) == 'object' && e.tagName != 'SCRIPT'
},
s = function () {
while (!o(e = f[r(f.length)])) {}
return e.style
};
while (i++ < 5) {
s().display = r(2) ? 'block' : 'inline';
s().position = r(2) ? 'absolute' : 'relative';
s().margin = r(2) ? '0' : '1em';
s().padding = r(2) ? '0' : '1em';
s().width = r(2) ? '' : 'auto';
}
})();
Every time you click the button, it does the following:1. Randomly selects an element from the page that isn't an object or a script.
2. Randomly switches the display property to either block or inline, the position property to absolute or relative, the margin property to 0 or 1 em, the padding property to 0 or 1em, and the width to a blank string or auto.
3. Repeats steps 1/2 until 5 elements have had these transformations applied.