Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
显示从数据库读取的html代码中的颜色_Html_Asp Classic_Db2_Background Color - Fatal编程技术网

显示从数据库读取的html代码中的颜色

显示从数据库读取的html代码中的颜色,html,asp-classic,db2,background-color,Html,Asp Classic,Db2,Background Color,我编写了一个简单的asp命令,该命令从数据库中检索HTML颜色代码,并将其显示在表中- <table border="1" width="75%" cellspacing="0" cellpadding="0" align="right"> <tr> <%for each x in rs.Fields response.write("<th>" & x.name & "</th>") next%> </tr>

我编写了一个简单的
asp
命令,该命令从数据库中检索HTML颜色代码,并将其显示在表中-

<table border="1" width="75%" cellspacing="0" cellpadding="0" align="right">
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
   <td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
end if
%>
</table>


在保存这些单独HTML颜色值的列中,是否有一种方法可以将其特定单元格的背景设置为各自的颜色?

尝试将您的值写入背景色

<table border="1" width="75%" cellspacing="0" cellpadding="0" align="right">
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
   <td style="background-color: #<%Response.Write(x.value)%>;"><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
end if
%>
</table>

尝试将值写入背景色

<table border="1" width="75%" cellspacing="0" cellpadding="0" align="right">
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
   <td style="background-color: #<%Response.Write(x.value)%>;"><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
end if
%>
</table>