【发布时间】:2014-05-28 03:47:10
【问题描述】:
我想更改 php 中选定选项项的背景颜色,但我可以这样做。我只使用下面的代码在所选选项的开头添加一个指示符(*),但我并不完全需要它。我需要在 php 中更改所选表单项的文本颜色。
将 style="background-color:red" 添加到 $a 是可行的。!
<select name="dest">
<?php
$a='';
$sql2 = "select evaperiod from evaluationperiod";
$query2 = mysql_query($sql2);
if(mysql_num_rows($query2)>0)
{
$x='20';
$guncel='';
while($result=mysql_fetch_array($query2))
{
$period = $result['evaperiod'];
if($period==$donemm)
$a=" selected='selected' style='background-color:red'";
if($period==$periodd)
$guncel='*';
else
$a='';
print "<option value='$period'$a>$guncel$x$period</option>";
$guncel='';
}
} ?>
</select>
【问题讨论】:
-
看看这个thread
标签: php css select colors option