AnD01
26-03-2008, 09:17
stop();
//functions
var pag_menu = new Array();
var node_cat = new Array();
var node_pla = new Array();
var node_pla_ok = new Array();
var cont = 0
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("xml.xml")
my_xml.onLoad = elabora_xml;
function elabora_xml(succes){
if (my_xml.loaded){
var cat = new Array;
var a
var b
var i
var j
var k
var tempo
var n_pag
node_cat = my_xml.firstChild.childNodes[1].childNodes;
node_pla = my_xml.firstChild.childNodes[0].childNodes;
for (i=0; i<node_cat.length;i++){
cat[0] = node_cat[i].attributes.name;
cat[1] = node_cat[i].childNodes[0].firstChild.nodeValue;
cat[2] = node_cat[i].childNodes[1].firstChild.nodeValue;
node_pla_ok.splice(0,node_pla_ok.length)
tempo = 1000 * cat[2]
//categorizzazione piatti
for (j=0; j<node_pla.length;j++){
if(node_pla[j].attributes.cat == cat[0]){
node_pla_ok.push(node_pla[j])
}
}
if (node_pla_ok.length > 0){
// paginazione piatti
n_pag = int(node_pla_ok.length / 10 +1)
for (j=1;j<=n_pag;j++){
a = (j*10)-9
b = (j*10)
a--
b--
setTimeout(scrivi_text, tempo, a,b)
}
}
}
}
}
function scrivi_text(a,b){
var delay = tempo
var piatti_ok = new Array
piatti_ok = node_pla_ok.slice(a,b)
trace(piatti_ok[0].childNodes[0].firstChild.nodeValue)
trace(piatti_ok[1].childNodes[0].firstChild.nodeValue)
}
Salve a tutti, il codice scritto, dovrebbe mostrare dei dati letti in un file xml per un certo intervallo di tempo, il problema è che solo quando j = 2 sul ciclo for (j=1;j<=n_pag;j++){ va nella funzione scrivi_text... Perchè??
//functions
var pag_menu = new Array();
var node_cat = new Array();
var node_pla = new Array();
var node_pla_ok = new Array();
var cont = 0
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("xml.xml")
my_xml.onLoad = elabora_xml;
function elabora_xml(succes){
if (my_xml.loaded){
var cat = new Array;
var a
var b
var i
var j
var k
var tempo
var n_pag
node_cat = my_xml.firstChild.childNodes[1].childNodes;
node_pla = my_xml.firstChild.childNodes[0].childNodes;
for (i=0; i<node_cat.length;i++){
cat[0] = node_cat[i].attributes.name;
cat[1] = node_cat[i].childNodes[0].firstChild.nodeValue;
cat[2] = node_cat[i].childNodes[1].firstChild.nodeValue;
node_pla_ok.splice(0,node_pla_ok.length)
tempo = 1000 * cat[2]
//categorizzazione piatti
for (j=0; j<node_pla.length;j++){
if(node_pla[j].attributes.cat == cat[0]){
node_pla_ok.push(node_pla[j])
}
}
if (node_pla_ok.length > 0){
// paginazione piatti
n_pag = int(node_pla_ok.length / 10 +1)
for (j=1;j<=n_pag;j++){
a = (j*10)-9
b = (j*10)
a--
b--
setTimeout(scrivi_text, tempo, a,b)
}
}
}
}
}
function scrivi_text(a,b){
var delay = tempo
var piatti_ok = new Array
piatti_ok = node_pla_ok.slice(a,b)
trace(piatti_ok[0].childNodes[0].firstChild.nodeValue)
trace(piatti_ok[1].childNodes[0].firstChild.nodeValue)
}
Salve a tutti, il codice scritto, dovrebbe mostrare dei dati letti in un file xml per un certo intervallo di tempo, il problema è che solo quando j = 2 sul ciclo for (j=1;j<=n_pag;j++){ va nella funzione scrivi_text... Perchè??