0
我在執行我的PHP/MySQL代碼到jgrowl時遇到問題。從MySQL表中獲取行並將它們顯示爲JGROWL通知
如果您熟悉jgrowl你就會知道它提供了類似的通知低吼確實爲OS X
我試圖把它從我的表讀取所有的記錄,但目前它只是顯示一個記錄作爲通知,並通過它循環4次。
另一個問題是,如果我在表中有5行,那麼jgrowl將只顯示4個通知將被查看。
如何獲取它以查看錶格中的所有記錄作爲通知,以及如何顯示記錄總數(5)作爲通知併爲當前丟失的記錄進行說明?
<script type="text/javascript">
// In case you don't have firebug...
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}
(function($){
$(document).ready(function(){
// This specifies how many messages can be pooled out at any given time.
// If there are more notifications raised then the pool, the others are
// placed into queue and rendered after the other have disapeared.
$.jGrowl.defaults.pool = 5;
var i = 1;
var y = 1;
setInterval(function() {
if (i < <?php echo $totalRows_comment; ?>) {
<?php
echo '$.jGrowl("'.$row_comment['comment'].'",';
?>
{
sticky: true,
log: function() {
console.log("Creating message " + i + "...");
},
beforeOpen: function() {
console.log("Rendering message " + y + "...");
y++;
}
});
}
i++;
} , 1000);
});
})(jQuery);
</script>
<p>
</span>
<p>
咆哮代碼效果很好,我只是難以理解的jquery部分,因爲我不熟悉它。我需要一些幫助來做到這一點 – methuselah 2010-05-27 02:58:14