<div id='divka'></div>
<script type="text/javascript">
var colors = [
"red",
"green",
"yellow",
"blue"
];
var n=colors.length;
var divka = document.getElementById("divka");
for(i=0;i<n;i++){
var rand = Math.floor(Math.random()*n);
divka.innerHTML += "<p style='color:" + colors[rand] + "'> " + "Hello world!" + "</p>";
};
</script>