samuil,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
window.onload = function ()
{
function mix(b) {
for (var c = document.createElement("div"), d = 0; d < b.length; d++) {
var a = Math.floor(Math.random() * b.length),
e = b[d],
f = e.parentNode,
a = b[a],
g = a.parentNode;
f.insertBefore(c, e);
g.insertBefore(e, a);
f.insertBefore(a, c)
}
c.parentNode.removeChild(c)
};
mix(document.getElementsByTagName("div"))
}
</script>
</head>
<body>
<div>1</div>aaaa<div>2</div>bbbb<div>3</div>cccc<div>4</div>dddd<div>5</div>
</body>
</html>