samedi 28 février 2015

Javascript code not running in browser

I have following javascript code and I am trying to run it on Google Chrome and Internet Explorer but in both I get a blank page. I can't understand what is the error in the script? Please tell me what is wrong with it.



<!DOCTYPE html>
<html>
<head>
<title>Changing Background Color</title>


</head>

<body>
<script type= "text/javascript">
document.write( "test run");
var colors={"red","orange","green","blue","brown","purple","gray","white"}
var index=0;
function changecolor()
{
for(index=0;colorindex<colors.length;index++)
{
document.bgcolor=colors[index];
}
}
function startchange()
{
setinterval("changecolor()",3000);
}
window.onload=startchange();
</script>
</body>

</html>




Aucun commentaire:

Enregistrer un commentaire