Below is the html code,
<body onload="alert('Hello')">
<h1>click here</h1>
</body>
below is the javascript code,
function init(){
var h1Tags = document.getElementsByTagName("h1");
h1Tags[0].onclick = changeColor;
}
function changeColor(){
this.innerHTML = "Click Again"
/*en.wikipsedia.org/wiki/List_of_colors:_A_F */
var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
this.style.color = randomColor;
}
document[onload] = init;
Above code is suppose to change the color of the header.
What is the problem in this code?