有2個div在該div上的數據我從「詳細信息」按鈕上的數據庫獲取記錄我想顯示那些div javascript不工作,當我應用java腳本它只顯示第一個ID我提出,我所使用的代碼,請大家給我soluation 我想隱藏或顯示div上的鼠標在按鈕上
<?php
$sml_add="SELECT * FROM small_add WHERE sub_dest='$sub_desti_id' AND active_hotel='YES' ";
$sml_add1=mysql_query($sml_add);
while($sml_add_res=mysql_fetch_assoc($sml_add1))
{
?>
<div class="col-md-2 col-sm-4">
<div class="small-add" style="height:263px;" >
<div class="result-box-heading">
<?php echo $sml_add_res["hotel_keyword"]; ?>
</div> <div class="clearfix"></div>
<center><img src="./../smalladd_picture/<?php echo $sml_add_res["image"]; ?>" class="img-responsive" style="width:130px;height:84px;padding:5px;"></center>
<div class="small-add-inner">
<h2 style="padding:-25px;"><?php echo $sml_add_res["hotel_name"]; ?></h2>
<p><?php echo $sml_add_res["location"]; ?></p>
<p style="color:#c90017;"><?php echo $sml_add_res["cost"]; ?></p>
<div class="small-add-but" style="width:95px;position:relative;top:16px;right:20px;"><a id="detail" style="border:1px solid #88D9FF;" >Details</a></div>
<div class="small-add-but"style="position:relative;right:-35px;top:-14px;" ><a style="border:1px solid #88D9FF;"href="hotel-details.php">Contact</a></div>
</div>
</div>
<style>
hr {
border-top:1px dotted #88D9FF;
color:#fff;
background-color:#fff;
height:-10px;
width:100%;
position:relative;
top:-25px;
}
</style>
<style>
#div1{
border:1px solid white;
height:260px;
width:500px;
position:absolute;
top:10px;
right:190px;
background:#1A8CFF;
border-radius:5px;
text-color:white;
}
</style>
<div id="div1" >
<img src="./../smalladd_picture/<?php echo $sml_add_res["image"]; ?>" height="80px" width="90px" style="margin:20px;">
<div style="position:absolute; top:15px; left:122px;">
<p style="color:white;"><?php echo $sml_add_res["hotel_keyword"]; ?></p>
<p style="color:white;"><?php echo $sml_add_res["hotel_name"]; ?></p>
<p style="color:white;"><?php echo $sml_add_res["location"]; ?></p>
<p style="color:white;"><?php echo $sml_add_res["cost"]; ?></p>
</div>
<hr>
<div style="position:relative;left:20px;top:-25px;">
<p style="color:white;">CUISINES: Biryani, North Indian, Mughlai, Chinese, Seafood</p>
<p style="color:white;">COST FOR TWO: Rs. 800</p>
<p style="color:white;">HOURS: 9 AM to 12 Midnight</p>
<p style="color:white;">FEATURED IN:Trending this Week</p>
</div>
</div>
</div>
<?php
} ?>
不工作先生。 – Vivek
我編輯瞭解決方案我解釋了爲什麼老年人沒有工作。您應該使用javascript或更改您的html樹,以將div1作爲詳細信息的子項。我向你推薦第一個選項。 – spaniard
sir其顯示div,但在兩個細節按鈕上它顯示有關第1條記錄的詳細信息。在第二個div中,我從數據庫中獲取的詳細信息是不同的。 – Vivek