用于网页中图像的灯箱模态

时间:2016-09-24 07:50:37

标签: php jquery html image lightbox

以下代码检索3张图像并显示在表格中!我已经导入了必要的jquery库和css脚本来实现灯箱模式!

            <?php
                require("includes/db.php");

                $sql="SELECT * FROM `order` ";
                $result=mysqli_query($db,$sql);
    echo"<head>";
    echo"<link rel='stylesheet' href='lightbox.css'>";
    echo"<script type='text/javascript' src='lightbox.min.js'>";
    echo"</script>";
    echo"</head>";

    echo "<body bgcolor=#E6E6FA>";
    echo "<table border=1 cellspacing=0 cellpadding=4 > " ;
while($row=mysqli_fetch_array($result))
{
  echo '<a href='.( $row['Image1'] ).'  data-lightbox="gallery"  >';
   echo "<img src='" .$row['Image1']. "' height='200' width='200'/>";
    echo "</a>";


    echo "<br>";
     echo"</td>";
    echo"<td align=center >";


    if($row['Image2']=="No copy"){
        echo "No copy";
    }
    else{
     echo '<a href='.( $row['Image2'] ).' data-lightbox="gallery" >';
   echo "<img src='" . $row['Image2'] . "' height='200' width='200'/>";
    }
    echo "</a>";


    echo "<br>";
     echo"</td>";
      echo"<td align=center >";

  if($row['Image3']=="No copy"){
        echo "No copy";
    }
    else{
     echo '<a href='.( $row['Image3'] ).'  data-lightbox="gallery"  >';
   echo "<img src='" . $row['Image3'] . "' height='200' width='200'/>";
    }
   echo "</a>";


    echo "<br>";


     echo"</tr>";

}
echo "</table>";

   ?> 

以上代码不起作用请帮帮我!我该如何纠正代码?我在开发人员工具中遇到以下错误!

lightbox.min.js:12 Uncaught TypeError: a is not a function
http://localhost/project1/test/images/close.png Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/project1/test/images/prev.png Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/project1/test/images/next.png Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/project1/test/images/loading.gif Failed to load resource: the server responded with a status of 404 (Not Found)

1 个答案:

答案 0 :(得分:0)

问题出在第12行的lightbox.min.js文件中,不在此PHP代码中。