日期:2014-05-16  浏览次数:20534 次

小弟遇到一难题 求大神帮忙
 <div id="spfl">
    
     <?php
         $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)
?>
     <span class="fl1">
        <img src="<?php echo $row["title_img"] ?>" width="160px">
        </span>
        <?php

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

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

?>
        <span class="fl2" onMouseOver="omo(this,'spfl_right_<?php echo $i?>')" onMouseOut="omout(this)" id="<?php echo  $row["child_id"]?>">
      <?php echo $row["child_type"] ;?>
        </span>
        
        <?php 
}
 ?>
        
         <div id="spfl_left">
        
         </div>
          <div id="spfl_right_<?php echo $i?>" class="spfl_right">
       
         </div>
  <?php } ?> 
    </div>
    <!--分类结束-->



(这是ajax的处理)

<?php
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