Oct 3rd, 2000, 04:17 PM
Hi there..... I'm trying to create a table and assign each one of its cells an id on the fly with my asp page. I have created a database that holds a set of generic ids to be used. Here's what my codes look like, maybe you'll understand better:
<%
set RS=server.createobject("adodb.recordset")
sql = "SLECT GenericIDs FROM IDs"
RS.open sql, "TaskManager", adOpenStatic, adLockPessimistic
RS.movefirst
Generated = RS("GenericIDs")
response.write "<table name=mytable border=2 cellspacing=1 width=500>"
response.write"<tr>"
FOR i = 0 to 8
response.write "<td id="&Generated&" onmousedown=AssignColor(Generated) width=30</td>"
RS.movenext
Generated = RS("GenericIDs")
NEXT
response.write "</tr></table>"
SUB AssignColor(id)
received = id
response.write "<script language=vbscript>mytable.cells.item(received).style.backgroundcolor=green </script>"
END SUB
%>
At this point it looks like the function AssignColor cannot be executed properly. The table is displayed but when I click on any cell I get a 'Error on page' response at the bottom left of my browser. I'd be extremely grateful if I could get some help on this one. Thanks in advance.
<%
set RS=server.createobject("adodb.recordset")
sql = "SLECT GenericIDs FROM IDs"
RS.open sql, "TaskManager", adOpenStatic, adLockPessimistic
RS.movefirst
Generated = RS("GenericIDs")
response.write "<table name=mytable border=2 cellspacing=1 width=500>"
response.write"<tr>"
FOR i = 0 to 8
response.write "<td id="&Generated&" onmousedown=AssignColor(Generated) width=30</td>"
RS.movenext
Generated = RS("GenericIDs")
NEXT
response.write "</tr></table>"
SUB AssignColor(id)
received = id
response.write "<script language=vbscript>mytable.cells.item(received).style.backgroundcolor=green </script>"
END SUB
%>
At this point it looks like the function AssignColor cannot be executed properly. The table is displayed but when I click on any cell I get a 'Error on page' response at the bottom left of my browser. I'd be extremely grateful if I could get some help on this one. Thanks in advance.