gardan06 Posted January 30, 2008 Share Posted January 30, 2008 I have: <div id="name"></div> Given the names "Michael", "Lue" and "Rachel" for example, how can i loop these 3 inside the div given? Is it even possible? In case you guys are wondering, i need it to put names in a table wherein the column has a limited width and height. Needless to say, it should only occupy 1 line, thus this solution. Thanks. Link to comment https://forums.phpfreaks.com/topic/88530-text-looping-in-javascript/ Share on other sites More sharing options...
phpQuestioner Posted January 30, 2008 Share Posted January 30, 2008 you mean like this: <div id="name"> <script language="javascript"> var people = new Array(); people[0] = "Michael"; people[1] = "Lue"; people[2] = "Rachel"; var max = people.length - 1; for (i=0;i<=max;i++) { document.write(""+people[i]+"<br/>"); } </script> </div> Link to comment https://forums.phpfreaks.com/topic/88530-text-looping-in-javascript/#findComment-453220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.