Skidz
12-11-2007, 01:31 PM
I want to return all of the tracks in each album tag, at the moment my script only returns the last one... i think it has something to do with the for loop but i'm not sure...
PS script is in PHP tags on this site just for colors.
function getxml(){
xmldoc=XML.load('music.xml');
var xmlmusic=xmldoc.getElementsByTagName('albums');
for(i=0;i < xmlmusic.length;i++){
musicdata=xmlmusic[i];
name=dataFromTag(musicdata,'title');
var s="<html>\n<head>\n</head>\n\n"
s+="<style>\n<!--\n.menu{\nfont-family: Arial,\nHelvetica, sans-serif;\nfont-size: 24px;\nfont-weight: bold;\n color:#3399ff}\n-->\n</style>\n\n"
s+="<body>\n";
s+="<form>\n<select size='"+name.length+"'>\n";
for(c=0;c<name.length;c++){
s+="<option class='menu'>"+name[c]+"</option>\n";
}
s+="</select>\n</form>\n</body>\n</html>";
with(document.getElementById('examples').contentDocument){
open();
write(s);
close();
}
}
}
PS script is in PHP tags on this site just for colors.
function getxml(){
xmldoc=XML.load('music.xml');
var xmlmusic=xmldoc.getElementsByTagName('albums');
for(i=0;i < xmlmusic.length;i++){
musicdata=xmlmusic[i];
name=dataFromTag(musicdata,'title');
var s="<html>\n<head>\n</head>\n\n"
s+="<style>\n<!--\n.menu{\nfont-family: Arial,\nHelvetica, sans-serif;\nfont-size: 24px;\nfont-weight: bold;\n color:#3399ff}\n-->\n</style>\n\n"
s+="<body>\n";
s+="<form>\n<select size='"+name.length+"'>\n";
for(c=0;c<name.length;c++){
s+="<option class='menu'>"+name[c]+"</option>\n";
}
s+="</select>\n</form>\n</body>\n</html>";
with(document.getElementById('examples').contentDocument){
open();
write(s);
close();
}
}
}