HTML_Table::altRowAttributes() – Alternate row attributes(备用行属性)语法 require_once 'HTML/Table.php';void HTML_Table::altRowAttributes ( int $start , mixed $attributes1 , mixed $attributes2 , boolean $inTR = false , int $body = null ) DescriptionAlternates the row attributes starting at $start(候补行属性,从$start开始)Parameter(参数) int $start - Row index of row in which alternating begins mixed $attributes1 - Associative array or string of table row attributes mixed $attributes2 - Associative array or string of table row attributes boolean $inTR - FALSE, if attributes are to be applied in td tags; TRUE, if attributes are to be applied in tr tag. int $body - The number of the tbody group that should be used. NULL indicates that all groups should be used.NoteThis function can not be called statically.(此功能不能被静态调用。)范例: $table->altRowAttributes(1,NULL,array('class'=>'alt'));
require_once 'HTML/Table.php';void HTML_Table::altRowAttributes ( int $start , mixed $attributes1 , mixed $attributes2 , boolean $inTR = false , int $body = null )
DescriptionAlternates the row attributes starting at $start(候补行属性,从$start开始)Parameter(参数) int $start - Row index of row in which alternating begins mixed $attributes1 - Associative array or string of table row attributes mixed $attributes2 - Associative array or string of table row attributes boolean $inTR - FALSE, if attributes are to be applied in td tags; TRUE, if attributes are to be applied in tr tag. int $body - The number of the tbody group that should be used. NULL indicates that all groups should be used.NoteThis function can not be called statically.(此功能不能被静态调用。)范例:
$table->altRowAttributes(1,NULL,array('class'=>'alt'));
array('class'=>'alt') 表示给 TR 标记添加 class='alt' 属性
请问换个什么方向啊?PEAR不是学PHP必须要懂的吗?在应用中都很有用的啊
那添加了class='alt'属性也说明不了调用了css文件啊。哪里可以体现出来?
定义CSS类 alt 也是你的事情,当然不定义就什么都是原样是说 PEAR不是学PHP必须要懂的吗?
你问问他们有几个用 PEAR 的?
我只知道,在国内用 PEAR 的不超过 10%
定义CSS类 alt 也是你的事情,当然不定义就什么都是原样
”这句话的意思
那添加了class='alt'属性也说明不了调用了css文件啊。
来的没有定义样式表 alt 类(class),HTML不会报错,只是显示默认的样式
哦。。你的意思是alt这个地方填写样式表的名称是吧
那么这个代码为什么不行?<?php
require_once 'D:/xampp/php/pear/HTML/Table1.8.3/Table.php';
require_once 'CSS/newfile.css';
$salesreport = array(
'0' => array("12309", "45633", "2007-12-19 01:13:42", "$22.04", "$5.67", "$27.71"),
'1' => array("12310", "942", "2007-12-19 01:15:12", "$11.50", "$3.40", "$14.90"),
'2' => array("12311", "7879", "2007-12-19 01:15:22", "$95.99", "$15.00", "$110.99"),
'3' => array("12312", "55521", "2007-12-19 01:30:45", "$10.75", "$3.00", "$13.75")
);
$attributes = array('border' => '1');
$table = new HTML_Table($attributes);
$table->setHeaderContents(0, 0, "Order ID");
$table->setHeaderContents(0, 1, "Client ID");
$table->setHeaderContents(0, 2, "Order Time");
$table->setHeaderContents(0, 3, "Sub Total");
$table->setHeaderContents(0, 4, "Shipping Cost");
$table->setHeaderContents(0, 5, "Total Cost"); for ($rownum = 0; $rownum < count($salesreport); $rownum++) {
for ($colnum = 0; $colnum < 6; $colnum++) {
$table->altRowAttributes(1, null, array("class" => "alt"));
$table->setCellContents($rownum+1, $colnum, $salesreport[$rownum][$colnum]);
}
}
echo $table->toHTML();
?>