<script type="text/javascript"> <!-- // Create the array threads threads = [ { threadid: 1, title: "Some thread title", poster: "Poster Uname or something" }, { threadid: 2, title: "Some thread title 2", poster: "Poster Uname or something 2" } ]; // Changed your for loop a little for (i=0;i<threads.length;i++) { // It's good practice to use {} with for loops // Your while loop was redundant. link = "http://www.foo.com/showthread.php?t="+threads[i].threadid; document.writeln("<h3><a href='"+link+"'>"+threads[i].title+"</a><br><small>posted by "+threads[i].poster+"</small></h3>"); } //--></script>