Forum Moderators: open
I tried inserting the script itself into the html page and dividing up the script into a table - but that didn't work. Seems I need to actually program the table itself in the javascript language and not html. Anybody have a clue how I could do this?
thanks!
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
<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.
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!