jdMorgan

msg:1491500 | 4:18 am on Jun 1, 2003 (gmt 0) |
Stace, I may be misunderstanding your question entirely, and I'm certainly no JavaScript wiz, but here is a simple example... Two rows of two columns, each including a variable to be displayed:
<script language="JavaScript" type="text/JavaScript">
var row1col1var = 'blue'; var row1col2var = 'widgets'; var row2col1var = 'green'; var row2col2var = 'widget';
document.write('<center><table width="75%" border="1">'); document.write('<tr align="center"><td>' + row1col1var + '</td><td>' + row1col2var + '</td></tr>'); document.write('<tr align="center"><td>' + row2col1var + '</td><td>' + row2col2var + '</td></tr>'); document.write('</table></center>'); </script>
Jim
|
mivox

msg:1491501 | 4:24 am on Jun 1, 2003 (gmt 0) |
I moved this thread over here to the HTML forum... you'll find a lot more help with coding here than you would in the Graphics forum. :)
|
MWpro

msg:1491502 | 5:47 am on Jun 1, 2003 (gmt 0) |
I'm just curious as to why you are trying to write the table with javascript. Is it like a random question thing? Or is the point of this script to just check if the answers are right? If you post what the point of doing this is maybe we can help you think of a better way of doing it.
|
g1smd

msg:1491503 | 6:45 am on Jun 1, 2003 (gmt 0) |
You'll need to escape the closing tags in javascript document.write statements, so a small change: <script language="JavaScript" type="text/JavaScript"> var row1col1var = 'blue'; var row1col2var = 'widgets'; var row2col1var = 'green'; var row2col2var = 'widget'; document.write('<center><table width="75%" border="1">'); document.write('<tr align="center"><td>' + row1col1var + '<\/td><td>' + row1col2var + '<\/td><\/tr>'); document.write('<tr align="center"><td>' + row2col1var + '<\/td><td>' + row2col2var + '<\/td><\/tr>'); document.write('<\/table><\/center>'); </script> Apart from that minor omission, a good answer, and the one that I would have given.
|
stace

msg:1491504 | 1:03 am on Jun 2, 2003 (gmt 0) |
Hi guys- actually it is a quiz program that is already in javascript - it gives the user several answers, then allows them to evaluate how they've done. The reason I wanted a table was because with 8 images it looks a lot better to have them in 2 columns rather than just 1 long page. I did manage to figure it out though! I just had to adapt regular a html table to the javascript format - ended up looking like this - at the beginning of the quiz I added this: "<table border=0 cellpadding=0 cellspacing=0 width='100%' bgcolor='#C0C0C0'><tr><td><td width='100%'>Question 1", then at the end of the line of script that I wanted to be the last question/image contained in column 1, I added </td><td> after the last question and image, a new line: "</td></tr></table>", worked great!
|
|