Here's something I have been wondering about. I was helping someone to make a prompt quiz, but a problem has occured. My friend wants to write a cell one by one in the same row when a prompt is answered. Instead, the entire table is only written after the </table> tag has been played. Here is an example of what I'm talking about:
<script language="JavaScript">
<!--
// Note this is just an example.
// To see this for yourself, feel free to download the file.
document.write("<table border=1 cellspacing=0>")
for(x=1;x<=5;x++)
{
document.write("<td>Tada!</td>")
alert("This message slows the for() loop. Box number "+x)
// The alert() box is there to stall the for() loop each time.
// This should write "Tada!" every time the for() loop
// has repeated. Instead, it does not show until the end.
// No new rows are created.
}
document.write("</table>")
// At this point the table has finally been written.
// It does not write it each time.
//-->
</script>
Try the Script for yourself if you want to see what I mean. Instead of writing "Tada!" every time the for() loop completes one round, it waits until the final "</table>" tag has been written. Is there a way to actually allow yourself to write a cell one at a time in the same row, without creating a new table (that just makes it go to the next line)? It may be challenging to solve, it may be not. It's something that is wanted to know .
<script language="JavaScript">
<!--
// Note this is just an example.
// To see this for yourself, feel free to download the file.
document.write("<table border=1 cellspacing=0>")
for(x=1;x<=5;x++)
{
document.write("<td>Tada!</td>")
alert("This message slows the for() loop. Box number "+x)
// The alert() box is there to stall the for() loop each time.
// This should write "Tada!" every time the for() loop
// has repeated. Instead, it does not show until the end.
// No new rows are created.
}
document.write("</table>")
// At this point the table has finally been written.
// It does not write it each time.
//-->
</script>
Try the Script for yourself if you want to see what I mean. Instead of writing "Tada!" every time the for() loop completes one round, it waits until the final "</table>" tag has been written. Is there a way to actually allow yourself to write a cell one at a time in the same row, without creating a new table (that just makes it go to the next line)? It may be challenging to solve, it may be not. It's something that is wanted to know .