Oppure

Loading
16/12/09 16:17
zottiman
devo creare un Tag Cloud statico, cioè, devo leggere i tag da un xml...
Ho scritto la prima versione, senza la lettura dall'xml, ma mettendo tutto in delle stringhe, ma sorge un problema.. non mi va l'innerHTML

var sNome = new Array("Progetto","Orientamento","Home");
var sUrl  = new Array("progetto.html","orientamento.html","home.html");
var sFont = new Array("Arial","Arial","Arial");
var sSize = new Array("12","9","24");
var sColor = new Array("blue","red","green");


/*Variabili programma FISSE
-----------------------------------------------------------------------------------*/
var sString = "";

/*-----------------------------------------------------------------------------------*/
Controllo();

function Controllo(){
	if (sNome.length == sUrl.length && sNome.length == sFont.length && sNome.length == sSize.length && sNome.length == sColor.length){
		Start();
		}
	else{
		alert("Errore inserimento TAG")
		}
	}

function Start(){
	for (var i=0; i<sNome.length ; i++){				/*Creo codice HTML*/
			var sI = i + "";
			sString = 	sString + 										
						"<p onclick='Url(" + sI + ")' " + 					/*richiemo la funz per il collegamento*/
						"style= '  font-family:" + sFont[i] + ";" + 		/*imposto font*/
						"font-size:" + sSize[i] + ";" + 					/*imposto grandezza*/
						"color:" + sColor[i] + ";" + "'>" +					/*imposto colore*/
						sNome[i] + 											/*nome del p*/
						"</p>&nbsp;&nbsp";
		}
		alert(sString);
		View(sString);		/*Visualizzo il codice nel div*/
	}
	
function View(view){document.getElementById("dCloud").innerHTML= view;}		/*Visualizzo il codice nel div*/
function Url(url){		/*faccio il collegamento al link*/
	url = url * 1;
	url = sUrl;
	location.href = url; 
	}


dovrei far si che i nomi che ci sono nelle stringhe

var sNome = new Array("Progetto","Orientamento","Home");
var sUrl  = new Array("progetto.html","orientamento.html","home.html");
var sFont = new Array("Arial","Arial","Arial");
var sSize = new Array("12","9","24");
var sColor = new Array("blue","red","green");


vengano lette da un xml che pensavo di strutturare così:
<Cloud>
     <Nome>"Progetto"</Nome>
     <Url>"progetto.html"</Url>
     <Font>"Arial"</Font>
     <Size>"12"</Size>
     <Color>"red"</Color>
</Cloud>
<Cloud>
     <Nome>"Orientamento"</Nome>
     <Url>"orientamento.html"</Url>
     <Font>"Arial"</Font>
     <Size>"9"</Size>
     <Color>"green"</Color>
</Cloud>
<Cloud>
     <Nome>"Home"</Nome>
     <Url>"home.html"</Url>
     <Font>"Arial"</Font>
     <Size>"24"</Size>
     <Color>"green"</Color>
</Cloud>

....


aaa