hazee
04-25-2008, 03:21 PM
This is HTML, Javascript and ASP
<html>
<script type="text/javascript">
function check(x)
{
document.getElementById("myTable").bgColor=x
}
</script>
<body>
<%
rs.CursorType = 2
rs.LockType = 3
rs.Open "SELECT * FROM tbl_students", adocon
do while rs.EOF=false
%>
<table id="myTable" width="200" border="1">
<tr>
<td><%=rs.fields(0)%></td>
</tr>
<tr>
<td><input type="checkbox" name="asd" onclick="check(this.value)" value="blue">Select to Print</td>
</tr>
</table>
<%rs.movenext
loop%>
</body>
</html>
This loop will generate as many tables as the number of records filtered by recordset object. If i click any checkbox it changes the background color of the first table generated by loop.
What I want is, that it should change the color of corresponding table. FOr example 3 records filtered, so 3 tables generated. If I click the checkbox in 3rd table, it should only change the color of 3rd table not first.
<html>
<script type="text/javascript">
function check(x)
{
document.getElementById("myTable").bgColor=x
}
</script>
<body>
<%
rs.CursorType = 2
rs.LockType = 3
rs.Open "SELECT * FROM tbl_students", adocon
do while rs.EOF=false
%>
<table id="myTable" width="200" border="1">
<tr>
<td><%=rs.fields(0)%></td>
</tr>
<tr>
<td><input type="checkbox" name="asd" onclick="check(this.value)" value="blue">Select to Print</td>
</tr>
</table>
<%rs.movenext
loop%>
</body>
</html>
This loop will generate as many tables as the number of records filtered by recordset object. If i click any checkbox it changes the background color of the first table generated by loop.
What I want is, that it should change the color of corresponding table. FOr example 3 records filtered, so 3 tables generated. If I click the checkbox in 3rd table, it should only change the color of 3rd table not first.