Forum Moderators: open
<HTML>
<HEAD>
<TITLE>coming</TITLE>
<SCRIPT TYPE="text/javascript">
var pr1= new Image();
pr1.src="images1.jpeg"
var pr2= new Image();
pr2.src="images2.jpeg"
var pr3= new Image();
pr3.src="images3.jpeg"
var pr4= new Image();
pr4.src="images4.jpeg"
var pr5= new Image();
pr5.src="images5.jpeg"
var pr6= new Image();
pr6.src="images6.jpeg"
var people=new Array( pr1.src, pr2.src, pr3.src, pr4.src, pr5.src, pr6.src);
function randomInteger(topInt)
{
return Math.round(Math.random()*topInt);
}
function chImage(builtInImageNum,arrayName,arrayNameNum)
{
document.images[builtInImageNum].src = arrayName[arrayNameNum];
}
var timeoutID0;
function repeatIntervalCh0(){
chImage(0,people,randomInteger(5));
timeoutID0 = setTimeout("repeatIntervalCh0()", 500 + math.random()*1000 );
}
var timeoutID1;
function repeatIntervalCh1(){
chImage(1,people,randomInteger(5));
timeoutID1 = setTimeout("repeatIntervalCh1()",1000);
}
var timeoutID2;
function repeatIntervalCh2(){
chImage(2,people,randomInteger(5));
timeoutID2 = setTimeout("repeatIntervalCh2()",1000);
}
function imageCh3()
{
chImage(0,people,randomInteger(5))
chImage(1,people,randomInteger(5))
chImage(2,people,randomInteger(5))
repeatIntervalCh0()
repeatIntervalCh1()
repeatIntervalCh2()
}
</SCRIPT>
</HEAD>
<BODY onload="imageCh3()" >
<div align="left"><IMG NAME = "chpeople1" SRC="images1.jpeg" BORDER="0" ALIGN="bottom" ALT="changing people"></div>
<div align="center"><IMG NAME = "chpeople2" SRC="images1.jpeg" BORDER="0" ALIGN="bottom" ALT="changing people"> </div>
<div align="right"><IMG NAME = "chpeople3" SRC="images1.jpeg" BORDER="0" ALIGN="bottom" ALT="changing people"> </div>
</BODY>
</HTML>
math is not defined
Javascript is case-sensitive (you know that. Just reminding you!)
It's
[b]M[/b]ath ---------------------------------------------------------------------------
There is a little anomaly here. Javascript usually follows the Java convention, whereby initial capitals a only used for classes (object classes - unrelated to CSS). The nearest thing to classes in JS are constructor functions, so JS gives them initial caps (String, Number,...).
Math is not (meant to be) a constructor function. It's just an object that serves as a handy place to put all mathematical functions. It should, by convention, be lower case -but it isn't