Ciao a tutti,
ho un file xml in cui memorizzo le notizie da far comparire nell'homepage del sito.
codice:
<?xml version="1.0" encoding="iso-8859-1"?>
<elenco>
<notizia>
<data>18/05/2005</data>
<titolo>Storaro: "Devo molto a mio padre e al cinema 'senza sonoro'" (3)</titolo>
<link>20050518_l7.htm</link>
</notizia>
<notizia>
<data>18/05/2005</data>
<titolo>Storaro: "Ecco i colori dell’Ultimo Imperatore" (2)</titolo>
<link>20050518_l6.htm</link>
</notizia>
<notizia>
<data>18/05/2005</data>
<titolo>18/05/2005 - Balduini: "il Ministero dice che la statalizzazione non si farà". Bogliolo: "Mi rifiuto di crederlo"</titolo>
<link>20050518_l5.htm</link>
</notizia>
<notizia>
<data>18/05/2005</data>
<titolo>Storaro: "Ecco i colori dell’Ultimo Imperatore"</titolo>
<link>20050518_l4.htm</link>
</notizia>
<notizia>
<data>18/05/2005</data>
<titolo>Convegno: fibrillazione cardiaca</titolo>
<link>20050518_l3.htm</link>
</notizia>
<notizia>
<data>18/05/2005</data>
<titolo>Giustizia: ingiurie via SMS</titolo>
<link>20050518_l2.htm</link>
</notizia>
<notizia>
<data>18/05/2005</data>
<titolo>Storaro: "Sogno di imparare e insegnare in una Urbino città ideale"</titolo>
<link>20050518_l1.htm</link>
</notizia>
</elenco>
Nell'homepage ho creato un input non modificabile che si dovrebbe aggiornare con i dati presi dall'XML.
codice:
<script language="javascript">
<!--
function aggiornamsg()
{
var StringaXml = DSO_Amici.XMLDocument;
if (document.formmsg.num.value=='1')
{
document.formmsg.msg.value='ULTIME NOTIZIE - '+StringaXml.documentElement.childNodes(0).childNodes(0).text+ ' - ' +StringaXml.documentElement.childNodes(0).childNodes(1).text;
document.formmsg.num.value='2';
}
else if (document.formmsg.num.value=='2')
{
document.formmsg.msg.value='ULTIME NOTIZIE - '+StringaXml.documentElement.childNodes(1).childNodes(0).text+ ' - ' +StringaXml.documentElement.childNodes(1).childNodes(1).text;
document.formmsg.num.value='3';
}
else if (document.formmsg.num.value=='3')
{
document.formmsg.msg.value='ULTIME NOTIZIE - '+StringaXml.documentElement.childNodes(2).childNodes(0).text+ ' - ' +StringaXml.documentElement.childNodes(2).childNodes(1).text;
document.formmsg.num.value='4';
}
else if (document.formmsg.num.value=='4')
{
document.formmsg.msg.value='ULTIME NOTIZIE - '+StringaXml.documentElement.childNodes(3).childNodes(0).text+ ' - ' +StringaXml.documentElement.childNodes(3).childNodes(1).text;
document.formmsg.num.value='5';
}
else if (document.formmsg.num.value=='5')
{
document.formmsg.msg.value='ULTIME NOTIZIE - '+StringaXml.documentElement.childNodes(4).childNodes(0).text+ ' - ' +StringaXml.documentElement.childNodes(4).childNodes(1).text;
document.formmsg.num.value='1';
}
var timer= setTimeout("aggiornamsg()",5000)
}
//-->
</script>
e il form è il seguente:
codice:
<body onload="aggiornamsg()">
<xml id="DSO_Amici" src="agenzia/news_homepage.xml"></xml>
<form name="formmsg" method="post" action="">
<input type="text" name="msg" size="120" class="newsticker" onfocus="this.blur()" onclick="parent.location.href('agenzia/ultimi.htm')">
<input type="hidden" name="num" value="3">
</form>
Premetto che ieri funzionava tutto alla perfezione, poi un'altro ci ha messo mano, e io non riesco a capire cosa abbia cambiato (e ha toccato solo il file XML)
grazie a tutti per l'aiuto...