evan
04-23-2009, 05:37 PM
this code will only execute twice.
what I want it to do is reset the value and start the loop over again
I don't know why it only works twice.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/stict.dtd">
<html>
<head>
<title>do while experiment</title>
</head>
<body>
you have 6 shots
<script type="text/javascript">
var load = 0;
bang();
function bang()
{
do {alert("you have " + load +" shots fired allready");
load++;
}
while (load <7);
}
if
(load = 7)
{
alert("you are out of shots-click to reload");
load = 0;
bang();
}
</script>
</body>
what I want it to do is reset the value and start the loop over again
I don't know why it only works twice.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/stict.dtd">
<html>
<head>
<title>do while experiment</title>
</head>
<body>
you have 6 shots
<script type="text/javascript">
var load = 0;
bang();
function bang()
{
do {alert("you have " + load +" shots fired allready");
load++;
}
while (load <7);
}
if
(load = 7)
{
alert("you are out of shots-click to reload");
load = 0;
bang();
}
</script>
</body>