循环jquery块ui
我正在尝试创建 300 个唯一的块 ui 实例,
到目前为止,这就是我所拥有的,但它不起作用:
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 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>
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 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将循环放入 $(document).ready
例如,
Put the looping inside $(document).ready
such as,