<h1 id='f'>
Some text
</h1>
<script type="text/javascript">
function rasta(element) {
var result = "";
for (var i = 0; i < element.innerHTML.length; i++) {
result += "<span style='color: rgb(" + ~~(Math.random() * 255) + ", " + ~~(Math.random() * 255) + ", " + ~~(Math.random() * 255) + ")'>" + element.innerHTML.charAt(i) + "</span>"
}
element.innerHTML = result;
}
rasta(document.getElementById("f"));
</script>