i am trying to create 300 unique instances of block ui
so far this is what i have, but it is not working:
javascript
<script type="text/javascript">
var i=0;
for (i=0;i<=300;i++) {
$(document).ready(function() {
$("#q" + i).click(function() {
$.blockUI({ message: $("#t" + i), css: { width: '1024px' } });
});
$('#yes').click(function() {
// update the block message
$.blockUI({ message: "<h1>Remote call in progress...</h1>" });
$.ajax({
url: 'wait.php',
cache: false,
complete: function() {
// unblock when remote call returns
$.unblockUI();
}
});
});
$('#no').click(function() {
$.unblockUI();
return false;
});
});
}
</script>
modal windows
<?php do { ?>
<div id="q<?php echo $row_dd31['dNo']; ?>" style="display:none; cursor: default">
<h3>Driver <?php echo $row_dd31['dNo']; ?></h3><p>
<input type="button" id="yes" value="Save" style="width: 75px; height: 50px;"/> <input type="button" id="no" value="Exit" style="width: 75px; height: 50px;"/>
</div>
<?php } while ($row_dd31 = mysql_fetch_assoc($dd31)); ?>
cell to开发者_如何学JAVA activate modal window
<tr height="100px" align="center">
<?php do { ?>
<td style="background-color: <?php echo $row_dd1['colour']; ?>;">
<input type="hidden" id="<?php echo $row_dd1['dNo']; ?>">
<button type="submit" class="link" id="t<?php echo $row_dd1['dNo']; ?>"><span><?php echo $row_dd1['dNo']; ?></span></button>
</td>
<?php } while ($row_dd1 = mysql_fetch_assoc($dd1)); ?>
</tr>
Put the looping inside $(document).ready
such as,
$(document).ready(function() {
var i=0;
for (i=0;i<=300;i++) {
精彩评论