使用MySQL在php中交替表行
问题描述:
嘿伙计们,
我已经googled高低,我似乎无法找到任何适用于表格的JavaScript或PHP代码我的index.php页面。这就是我现在所拥有的:
Hey guys,
I''ve googled high and low and I can''t seem to find any javascript or php code that works with the table on my index.php page. Here''s what I have now:
<script language="javascript">
function setcolor() {
var tbl = document.getElementById("myTable");
tbl.style.color = "white";
tbl.rows[0].style.backgroundColor = "#ffffff";
for (var i = 1; i < tbl.rows.length; i++) {
if (i % 2 == 0)
tbl.rows[i].style.backgroundColor = "#f4f4f4";
else
tbl.rows[i].style.backgroundColor = "#ffffff";
}
}
</script>
......
<table class="myTable" id="myTable" >
<tr>
<td width="85" align="center"><? echo "<font color=#0099FF>" .$recordSet["Driver"] . "</font>"; ?></td>
<td width="130" align="center"><? echo "<font color=#0099FF>" .$recordSet["Car"] . "</font>"; ?></td>
<td width="40" align="center"><? echo "<font color=#0099FF>" .$recordSet["Time"] . "</font>"; ?></td>
<td width="55" align="center"><? echo "<font color=#0099FF>" .$recordSet["Drivetrain"] . "</font>"; ?></td>
<td width="15" align="center"><? echo "<font color=#0099FF>" .$recordSet["PP"] . "</font>"; ?></td>
<td width="30" align="center"><? echo "<font color=#0099FF>" .$recordSet["Level"] . "</font>"; ?></td>
</tr>
</table>
有没有办法直接这样做在PHP?或者JS的任何建议更改?我愿意接受任何建议。在此先感谢!
Jerome
Is there a way to do it directly in php? Or any suggested changes in JS? I''m open to any suggestions. Thanks in advance!
Jerome
答
recordSet [ Driver]。 < / font>; ?> < / td >
< td width = 130 align = center > <? echo < ; font color =#0099FF>。
recordSet["Driver"] . "</font>"; ?></td> <td width="130" align="center"><? echo "<font color=#0099FF>" .
recordSet [ 汽车]。 < / font>; ?> < / td >
< td width = 40 align = center > <? echo < ; font color =#0099FF>。
recordSet["Car"] . "</font>"; ?></td> <td width="40" align="center"><? echo "<font color=#0099FF>" .
recordSet [ 时间]。 < / font>; ?> < / td >
< td width = 55 align = center > <? echo < ; font color =#0099FF>。
recordSet["Time"] . "</font>"; ?></td> <td width="55" align="center"><? echo "<font color=#0099FF>" .