当我在 PHP 中使用 While 时,如何弹出正确的 javascript 框。这是代码:
while($result= mysql_fetch_array($data)){
<tr class="<?php echo $style;?>">
<td><?php echo $result['commissie'];?></td>
<td class="small"><?php echo $result['volgorde'];?></td>
<td class="small">
<div id="dialog-overlay"></div>
<div id="dialog-box">
<div class="dialog-content">
<h1>Verwijder van commissie: "<?php echo $result['commissie'];?>"</h1>
<div id="dialog-message">
<p>Weet je zeker dat je <?php echo $result['commissie'];?>. <?php echo $result_achternaam;?> wilt verwijderen uit de commissie? Dit betekend dat het contactpersoon automatisch zal worden verwijdert uit het systeem.</p>
</div>
<a href="../checks/delete_commissie.php?id=<?php echo $result['id'];?>" class="button">Ja</a>
<a href="#" class="button_no">Nee</a>
<div class="clear"></div>
</div>
</div>
</div>
<a href="javascript:popup('<?php echo $result['id'];?>')"><img src="../../images/delete.png"/></a>
</td>
</tr>
<?php }//CLOSE THE WHILE
这是javascript:
$(document).ready(function () {
$('a.button_no').click(function () {
$('#dialog-overlay, #dialog-box').hide();
return false;
});
$(window).resize(function () {
if (!$('#dialog-box').is(':hidden')) popup();
});
});
function popup() {
var maskHeight = $(document).height();
var maskWidth = $(window).width();
var dialogTop = (maskHeight/3) - ($('#dialog-box').height());
var dialogLeft = (maskWidth/2) - ($('#dialog-box').width()/2);
$('#dialog-overlay').css({height:maskHeight, width:maskWidth}).show();
$('#dialog-box').css({top:dialogTop, left:dialogLeft}).show();
}
问题是当我显示一个对话框时,系统总是会弹出第一个对话框,因为在 WHILE 的表中