php ajax 投票条形图显示问题 急!!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/06/08 07:58:32
session_start();
include 'conn.php';
$id=$_SESSION["id"];
$question=$_SESSION["question"];
$sql_vote="select * from odb where qid='$id'";
$file=mysql_query($sql_vote, $conn);
$content=array();
$vote=array();
while($row=mysql_fetch_assoc($file)){
array_push($content, $row["content"]);
array_push($vote, $row["vote"]);}
function rectStat($question,$content,$vote,$direct="H")
{ $idx = 0;
$sum = array_sum($vote);
$strHTML = "<table width='".(($direct=="H") ? "500" : "98%")."' border='0' cellspacing='1' cellpadding='1' bgcolor='#CCCCCC' align='center'>\n<tr><td bgcolor='#FFFFFF'>\n";
$strHTML .= "<table width='100%' border='0' cellspacing='2' cellpadding='2'>

没试过用<img width="xxpx" />的写法。
楼主,你可以试试
$strHTML .= "<tr><td width='16%' align='right'>".$content[$idx]."</td><td width='84%'><img src='../images/h_line2.gif' style='border:none; height:7px; width:".(($val/$sum)*360)."px' /> ".($vote[$idx]*100/$sum) ."%</td></tr>\n";

火狐和IE的JS标准不同,相同的JS代码效果可能不一样,网上有兼容两者的ajax写法

你的tabale没有闭合,ff比较严谨,ie比较宽松

html里写 php内容要加标签<? xxx ?>