pnj
Nov 17th, 2000, 04:26 PM
check this code out.
+++++++++++++++++++++++++++++++
<script>
var optNum =1;
var n = 5;
var intTime = 30;
function BuildHorizontal()
{
optNum = eval(document.frmChoice.txtChoice.value);
if (n >= 1)
{
document ["sbh" + optNum + n] .src = "images/blue.gif"
n--;
setTimeout("BuildHorizontal()",intTime);
}
else
{
n = 1;
BuildVertical();
}
}
function BuildVertical()
{
if (optNum <= 4)
{
if (n <= 5)
{
document ["sb" + optNum + n] .src = ["images/blue.gif"]
n++
setTimeout("BuildVertical()",intTime);
}
else
{
n=1;
optNum++;
BuildVertical();
}
}
else
{
n = 4;
}
}
function ClearHorizontal()
{
if (n >= 1)
{
document["sbh" + optNum + n] .src = "images/empty.gif";
n--;
ClearHorizontal();
}
else
{
n = 1;
ClearVertical();
}
}
function ClearVertical()
{
if (optNum <= 4)
{
if (n <= 4)
{
document ["sb" + optNum + n] .src = "images/empty.gif";
n++;
ClearVertical();
}
else
{
n=1;
optNum++;
ClearVertical();
}
}
else
{
n = 5;
BuildHorizontal();
}
}
</script>
++++++++++++++++++++++++++++
the html looks like this
+++++++++++++++++++++++++++++++
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sb11">1</td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh11">2</td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh12"></td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh13"></td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh14"></td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh15">5</td>
</tr>
</table>
+++++++++++++++++++++++++++++
what I would like to happen is when the site is loaded,the blue image is loaded into the table cells using the setTimeout thing.
I have a form(for the frmChoice) and onLoad(to call the function) event but I just cant get this thing to work..
this should be fairly simple for an expert.
thanks
+++++++++++++++++++++++++++++++
<script>
var optNum =1;
var n = 5;
var intTime = 30;
function BuildHorizontal()
{
optNum = eval(document.frmChoice.txtChoice.value);
if (n >= 1)
{
document ["sbh" + optNum + n] .src = "images/blue.gif"
n--;
setTimeout("BuildHorizontal()",intTime);
}
else
{
n = 1;
BuildVertical();
}
}
function BuildVertical()
{
if (optNum <= 4)
{
if (n <= 5)
{
document ["sb" + optNum + n] .src = ["images/blue.gif"]
n++
setTimeout("BuildVertical()",intTime);
}
else
{
n=1;
optNum++;
BuildVertical();
}
}
else
{
n = 4;
}
}
function ClearHorizontal()
{
if (n >= 1)
{
document["sbh" + optNum + n] .src = "images/empty.gif";
n--;
ClearHorizontal();
}
else
{
n = 1;
ClearVertical();
}
}
function ClearVertical()
{
if (optNum <= 4)
{
if (n <= 4)
{
document ["sb" + optNum + n] .src = "images/empty.gif";
n++;
ClearVertical();
}
else
{
n=1;
optNum++;
ClearVertical();
}
}
else
{
n = 5;
BuildHorizontal();
}
}
</script>
++++++++++++++++++++++++++++
the html looks like this
+++++++++++++++++++++++++++++++
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sb11">1</td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh11">2</td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh12"></td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh13"></td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh14"></td>
<td width="8" height="8"><img src="images/empty.gif" width="8" height="8" name="sbh15">5</td>
</tr>
</table>
+++++++++++++++++++++++++++++
what I would like to happen is when the site is loaded,the blue image is loaded into the table cells using the setTimeout thing.
I have a form(for the frmChoice) and onLoad(to call the function) event but I just cant get this thing to work..
this should be fairly simple for an expert.
thanks