Post by markl on Jan 3, 2008 12:54:49 GMT -5
This is probably not much of anything, but I was curious if I could embed HTML table code into a for next loop to create a cell like grid layout. Input column and row dimensions and it displays a grid according to your input. No data checking at the moment.
'------------------
a5$="data"
columns = 5
rows = 7
print "The following questions will ask you the grid size in columns and rows"
print ""
input "How many columns ?"; columns
input "How many rows ?"; rows
print ""
html "<table align=center cellpadding=10 border=2 style=""background-color:#9CEF10"">"
'==================================================
'<!-- add columns in grid -->
'Use the for next function to add columns
'==================================================
html " <tr><td class=""grdhdr""> "
for i = 1 to columns
html "</td><td class=""grdhdr"">"
print "COL-"+str$(i)
next i
html "</td></tr> "
'==================================================
'<!-- add rows in grid -->
'Use the for next function to add rows
'==================================================
for i = 1 to rows
html " <tr><td class=""grdhdr"">"
print "row-"+str$(i)
for n = 1 to columns
html "</td><td class=""grdbdy"">"
print a5$
next n
html "</td></tr> "
next i
html "</table> "
html "<style>
.grdhdr{background-color:#5858A8;
font-family:arial,sans-serif;
font-weight:bold;
font-size:12px;
text-align:center;
color:#F8FAFA }
.grdbdy {background-color:#EFEBCD;
font-family:arial,sans-serif;
font-weight:bold;
font-size:10px;
text-align:left;
color:#602400 };
</style>"
'-----------------------------------------------------------------
Code updated above to prevent uneven grid frame. Columns and rows variables added and input question used to fill variables.
'------------------
a5$="data"
columns = 5
rows = 7
print "The following questions will ask you the grid size in columns and rows"
print ""
input "How many columns ?"; columns
input "How many rows ?"; rows
print ""
html "<table align=center cellpadding=10 border=2 style=""background-color:#9CEF10"">"
'==================================================
'<!-- add columns in grid -->
'Use the for next function to add columns
'==================================================
html " <tr><td class=""grdhdr""> "
for i = 1 to columns
html "</td><td class=""grdhdr"">"
print "COL-"+str$(i)
next i
html "</td></tr> "
'==================================================
'<!-- add rows in grid -->
'Use the for next function to add rows
'==================================================
for i = 1 to rows
html " <tr><td class=""grdhdr"">"
print "row-"+str$(i)
for n = 1 to columns
html "</td><td class=""grdbdy"">"
print a5$
next n
html "</td></tr> "
next i
html "</table> "
html "<style>
.grdhdr{background-color:#5858A8;
font-family:arial,sans-serif;
font-weight:bold;
font-size:12px;
text-align:center;
color:#F8FAFA }
.grdbdy {background-color:#EFEBCD;
font-family:arial,sans-serif;
font-weight:bold;
font-size:10px;
text-align:left;
color:#602400 };
</style>"
'-----------------------------------------------------------------
Code updated above to prevent uneven grid frame. Columns and rows variables added and input question used to fill variables.