我已經建立了我的站點來使用gitter彈出系統。 javascript看起來像這樣:從php中構建javascript陣列
$(document).ready(function(){
setTimeout(function() {
$.gritter.add({
title: 'Welcome!',
text: 'This appears to be your first time playing. Blablabla',
time: '25000'
});
}, 500);
setTimeout(function() {
$.gritter.add({
title: 'Walkthrough',
text: 'A walkthrough was setup ...',
time: ''
});
}, 30000);
setTimeout(function() {
$.gritter.add({
title: 'You got mail',
text: 'You have received a message from x ',
time: ''
});
}, 36000);
這是3個彈出窗口的示例。我想要做的是有這樣的數組:
$popup_title[0] = "Welcome!";
$popup_text[0] = "This appears to be ...");
$popup_time[0] = 25000;
$popup_title[1] = "Walkthrough";
$popup_text[1] = "A basic blabla ...");
$popup_time[1] = "";
並循環這個數組(如果它們不是空的)並基於數組構造javascript。