将工具提示添加到css printfile表


Adding tooltip to css printfile table

我想从文件中打印一个表,这样对于非极客群体来说,不需要我的帮助就可以轻松地更新表。问题是,我希望表的顶部行为每个列打印不同的工具提示。我如何在php中做到这一点,或者有更好的方法吗?

echo "<tr><th>Date Available From (TOOLTIP) </th><th> Photo (TOOLTIP)</th><th> Age (TOOLTIP)</th><th> Breed (TOOLTIP)</th>

<?php 
$tdcount = 1; $numtd = 13; // number of cells per row 
print "<table class='hovertable'>";
print "<tr><th colspan=13><h1>AVAILABLE HORSES</h1></th></tr>";
       echo "<tr><th>Date Available From  </th><th>Photo</th><th>Age</th><th>Breed</th><th>Gender</th><th>Height</th><th>Colour</th><th>Price</th><th>Bred</th><th>Training</th><th>Known soundess illness injuries</th><th>Description</th><th>Status</th></tr>";
        $f = fopen("available.txt", "r") or die("can't open file"); 
        while (!feof($f)) { 
        $arrM = explode(",",fgets($f)); 
    $row = current ( $arrM ); 
    if ($tdcount == 1) 
    print "<tr onmouseover='"this.style.backgroundColor='#f9ce68';'" onmouseout='"this.style.backgroundColor='#d4e3e5';'">"; print "<td>$row </td>"; 
        if ($tdcount == $numtd) { 
            print "</tr>"; 
            $tdcount = 1; 
        } else { 
            $tdcount++; 
        } 
        } 
        if ($tdcount!= 1) { 
            while ($tdcount <= $numtd) { 
                print "<td>&nbsp;</td>"; $tdcount++; 
            } print "</tr>"; 
        } 
        print "</table>"; 
    ?> 

固定它。

把表和第一行从php中拉出来,他们不需要在那里,现在我没有问题,把工具提示放在我想要的图像上。

感谢大家的建议!:)

要部分回答你的问题,你可以使用:
<th title='Date Available From'>Date Available From</th>,仅在Firefox和IE7中测试。

至于你关于人们自己更新字段的问题,你必须查看数据库;flatfile或SQL.

所有标题已添加到表的顶行:

<?php
$tdcount = 1; $numtd = 13; // number of cells per row 
print "<table class='hovertable'>";
print "<tr><th colspan=13><h1>AVAILABLE HORSES</h1></th></tr>";
   echo "<tr><th title='Date Available From'>Date Available From  </th><th title='Photo'>Photo</th><th title='Age'>Age</th><th title='Breed'>Breed</th><th title='Gender'>Gender</th><th title='Height'>Height</th><th title='Colour'>Colour</th><th title='Price'>Price</th><th title='Bred'>Bred</th><th title='Training'>Training</th><th title='Known soundess illness injuries'>Known soundess illness injuries</th><th title='Description'>Description</th><th title='Status'>Status</th></tr>";
    $f = fopen("available.txt", "r") or die("can't open file"); 
    while (!feof($f)) { 
    $arrM = explode(",",fgets($f)); 
$row = current ( $arrM ); 
if ($tdcount == 1) 
print "<tr onmouseover='"this.style.backgroundColor='#f9ce68';'" onmouseout='"this.style.backgroundColor='#d4e3e5';'">"; print "<td>$row </td>"; 
    if ($tdcount == $numtd) { 
        print "</tr>"; 
        $tdcount = 1; 
    } else { 
        $tdcount++; 
    } 
    } 
    if ($tdcount!= 1) { 
        while ($tdcount <= $numtd) { 
            print "<td>&nbsp;</td>"; $tdcount++; 
        } print "</tr>"; 
    } 
    print "</table>"; 
?>