gpt4 book ai didi

php - 将工具提示添加到 css 打印文件表

转载 作者:太空宇宙 更新时间:2023-11-04 15:03:11 25 4
gpt4 key购买 nike

我想从一个文件中打印一个表格,以便非极客群体无需我的帮助即可轻松更新该表格。问题是我希望表格的第一行为每一列打印不同的工具提示。我如何在 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 中测试。

关于人们自己更新字段的问题,您必须查看数据库;平面文件或 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>";
?>

关于php - 将工具提示添加到 css 打印文件表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16218305/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com