I'm trying to save an array, and it is saving if I click on another
tab and then back to this "Playlist" tab, but when the page is
refreshed (and this tab is on a timer to refresh every 30 seconds) the
array is lost. The data that populates the array is retrieved from an
xsl file and each element is a DocumentFragment (a fragment of a
document tree). Here's my code:
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
var song = xsltProcessor.transformToFragment(xml,document);
songArr = prefs.getArray('songArray');
// if there are already songs in array
if(songArr.length > 0)
{
var last_song = songArr.slice(songArr.length-1);
// if new song isn't already in array
if(last_song.childNodes[2].textContent !=
song.childNodes[2].textContent)
{
if(songArr.length != 5) // if array isn't "full"
{
songArr.push(song);
}
else
{
songArr.shift();
songArr.push(song);
}
}
}
else // array is empty
{
songArr.push(song);
}
document.getElementById(id).innerHTML = "";
for(i=0; i<songArr.length; i++)
{
document.getElementById(id).appendChild(songArr[i]);
prefs.setArray('songArray', songArr[i]);
}
As of now, only one song is ever getting output. I'm trying to output
5. The complete code for the gadget is here:
http://kexp-developing-gadget.googlecode.com/svn/trunk/kexp_rss_gadget.xml
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---