Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to break results of a loop onto a new line

Status
Not open for further replies.

tippytarka

Programmer
Jul 19, 2004
115
GB
hi.. i've produced this script to load and loop through an XML file

Code:
////init TextArea component
menu.html = true;
menu.wordWrap = true;
menu.multiline = true;
menu.label.condenseWhite=true;

////load css
nomadStyle = new TextField.StyleSheet();
nomadStyle.load("nomadstyles.css");
menu.styleSheet = nomadStyle;

////load in XML
allData = new XML();
allData.ignoreWhite = true;
allData.load("roster_01_menu_artists_test.xml");
allData.onLoad = function(success)
{
        if(success)
        {
				
                menu.text = allData;
		allData=this.firstChild.childNodes;
		for(i=0; i<allData.length; i++) {
		menu=allData[i].attributes.text;
		}
        }
}

and i get this result...

onetwothree
but what i want is to get this result....

one
two
three
can you help??

cheers!
 
This might sound really basic, but have you tried adding a <br> tag in the loop itself?

Code:
for(i=0; i<allData.length; i++) 
{
    menu=allData[i].attributes.text + "<br>";
}

HTH

tigerjade :)

"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live." -- Martin Golding


 
something like may be better..untested

//menu.text = allData;
allData=this.firstChild.childNodes;
for(i=0; i<allData.length; i++) {
menu.text +=allData.attributes + newline;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top