小弟碰到一難題 求大神幫忙

來源:互聯網
上載者:User
小弟遇到一難題 求大神幫忙


$rs=mysql_query("select * from title");
$row=mysql_fetch_array($rs);
$num=mysql_num_rows($rs);
//echo $num;
for($i=1;$i<=8;$i++)
{
$rs=mysql_query("select * from title where parent_id=$i");
$row=mysql_fetch_array($rs);
//print_r($row)
?>

" width="160px">


$sql="select * from index_kind where parent_id=$i";
$rs=mysql_query($sql);

while($row=mysql_fetch_array($rs))
{

?>
">



}
?>




" class="spfl_right">








(這是ajax的處理)

require_once 'conn.php';
$child_id=$_GET["id"];
$rs=mysql_query("select * from index_kind where child_id='$child_id'");
$row=mysql_fetch_array($rs);
$nums=mysql_num_rows($rs);
for($i=1;$i<=$nums;$i++)
{
echo $row["good_img"];
}
?>


(這裡是AJAX)
function omo(obj,str)
{
//alert(str);
obj.style.borderBottom="1px solid #e4393c";
//alert(obj.id);
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHttp");
}
xmlhttp.open("get","chuli.php?id="+obj.id,true);
xmlhttp.onreadystatechange=function(){
//alert(xmlhttp.readyState)
if(xmlhttp.readyState==4)
{
alert(xmlhttp.responseText)

document.getElementById(str).innerHTML="";

}
}
xmlhttp.send(null);
}

這是我測試用的資料庫



然後當我移到這個劃紅線的地方是彈出的是圖片的地址




我想讓圖片顯示在下方的黑框裡 但是弄不出來啊 !!! 求大神幫幫忙解決下問題!!!

分享到: 更多


------解決方案--------------------
既然你 document.getElementById(str).innerHTML="";
那麼 xmlhttp.responseText 中就應該是一個合法的圖片路徑
而你 alert(xmlhttp.responseText) 看到的卻是多個,把這多個圖片名當做一個圖片的路徑,無論如何也是不會顯示的
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.