JohnM5
08-05-2003, 08:56 PM
This is supposed to simulate a traffic light changing.
problem is that it only does one change, ie red to orange, not orange to green as well
Anyone got ideas? (probably really easy!!)
(Light files not attached - easy enough to replicte)
<HTML>
<HEAD>
<SCRIPT language=javascript>
<!--
function change() {
if(lights.src="redlght.bmp")
lights.src="oranlght.bmp"
else if (lights.src="oranlght.bmp")
lights.src="greenlght.bmp"
else lights.src="redlght.bmp"
}
//-->
</SCRIPT>
</HEAD>
<BODY bgColor=lavender>
<P><IMG height=185 src="redlght.bmp" width=62 align=left
border=0 name=lights></P>
<P align=center><INPUT onclick=change() type=button value=Change name=next></P>
</body>
</html>
problem is that it only does one change, ie red to orange, not orange to green as well
Anyone got ideas? (probably really easy!!)
(Light files not attached - easy enough to replicte)
<HTML>
<HEAD>
<SCRIPT language=javascript>
<!--
function change() {
if(lights.src="redlght.bmp")
lights.src="oranlght.bmp"
else if (lights.src="oranlght.bmp")
lights.src="greenlght.bmp"
else lights.src="redlght.bmp"
}
//-->
</SCRIPT>
</HEAD>
<BODY bgColor=lavender>
<P><IMG height=185 src="redlght.bmp" width=62 align=left
border=0 name=lights></P>
<P align=center><INPUT onclick=change() type=button value=Change name=next></P>
</body>
</html>