PDA

View Full Version : سوال: اصلاح کد گزارش گیری



rash44
سه شنبه 29 اردیبهشت 1388, 18:43 عصر
سلام
من توی گزارش گیری ها می خوام سطر های جدول یکی در میون رنگ پس زمینه هاشون با هم فرق کنه مثل خیلی از سایت های دیگه
مثلا سطر اول سفید سطر دوم خاکستری سطر سوم سفید سطر چهارم خاکستری و ...
این کد باید به چه صورت اصلاح بشه ؟





<td align="center" width="58" bgcolor="#FFDB91">
<p dir="rtl">
<font face="Tahoma" style="font-size: 9pt; font-weight:700" color="#333333">
تعداد</font></td>
<td align="center" bgcolor="#FFDB91">
<p dir="rtl">
<font face="Tahoma" style="font-size: 9pt; font-weight:700" color="#333333">
نوع</font></td>
<td align="center" width="297" bgcolor="#FFDB91">
<p dir="rtl">
<font face="Tahoma" style="font-size: 9pt; font-weight:700" color="#333333">
نام محصول</font></td>
<td align="center" width="20" bgcolor="#FFDB91">
</td>
</tr><?php
while ($line = db_fetch_assoc($result)) { ?>
<tr>
<td align="center" width="58">
<input type="text" name="cout[]" size="5" class="inform" value="1" maxlength="5"></td>
<td align="center">
<font face="Tahoma" style="font-size: 8pt; " color="#333333"><?php echo $typem; ?></font></td>
<td align="center" width="297" dir="rtl">
<font face="Tahoma" style="font-size: 9pt" color="#333333"><?php echo ($line['name']); ?></font></td>
<td align="center" width="20" dir="rtl">
<p align="right"><font face="Tahoma">
<span style="font-size: 8pt"><font color="#003366">
<input type="checkbox" name="namem[]0" value="<?php echo ($line['id']); ?>"> </font></span></font></td></tr><?php } ?>

arlabbafi
سه شنبه 29 اردیبهشت 1388, 19:12 عصر
اگه با Css آشنايي داري ميتوني يك كلاس even و يك كلاس odd تعريف كني و براي اونا background رو عوض كني:
اگه هم آشنايي نداري حتما برو دنبالش

<style type="text/css">
.even{background:#CCCCCC;}
.odd{background:#333333;}
</style>
<?php
$i=0;
while($row=.........){
$i++;
?>
<tr class="<?=($i%2==0)?'even':'odd'?>" >
.
.
.
</tr>
<?php
}
?>