我想在用戶點擊添加到購物車按鈕時在我的html頁面上添加彈出窗口。 Popupwindow只有在extra_option標誌爲yes時才需要打開。否則,它應該只是將產品添加到籃子裏(這對我來說很好)。如何在我的HTML頁面中添加彈出窗口
這是我的代碼。
<form method="post">
<div class="col-md-12 col-sm-12 col-xs-12 pContainer">
<div class="col-md-3 col-sm-3 col-xs-12 wrap">
<div class="col-md-12 col-sm-12 col-xs-12 ">
<img src="img/delivery/products/<?=$r['ImgUrl'];?>" class="img img-responsive" style="width:auto">
</div>
</div>
<div class="col-md-9 col-sm-9 col-xs-12">
<div class="col-md-9 col-sm-9 col-xs-12 pNameNdiscription">
<h4> <b> <?=$r['ProductName']?> </b> </h4>
<p> <?=$r['Description']?> </p>
</div>
<div class="col-md-3 col-sm-3 col-xs-12 wrap" style="float:right" >
<div class="col-md-12 col-sm-12 col-xs-6 priceWrapper">
<h4 style="color:black" class="pPRICE"> <b> Rs. <?=$r['Price']?> </b> </h4>
</div>
<div class="col-md-12 col-sm-12 col-xs-6 add2CartWrapper">
<?php if($r['extra_option'] == 'yes') {
// if extra_option is 'yes' when user click on 'Add To Cart' I want to show here a popup widow to select the extra option. Otherwise just add the product into the cart.
// I am unable to properly add a model/popup windo.
<input type="button" id="ad2cart" name="ad2cart" class="btn add2Cart" value="Add To Cart" onclick='updateCart("<?=$r['id']?>")'>
}
</div>
</div>
</div>
<div class="col-sm-12 col-md-12 col-xs-12"> <hr> </div>
</div>
我不明白你的問題在這裏。你只需要添加一個彈出的代碼? Bootstrap內置了被稱爲「模態」的彈出窗口。 – ProEvilz