It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Display Array

Display Array

Postby hiyatran on Thu Aug 25, 2011 3:12 am

I would like to display the elements in my array but it is NOT working. Here's my code:

Code: Select all
<HTML>
<HEAD>
<TITLE>Test Input</TITLE>
<script type="text/javascript">

function addtext() {
   var openURL=new Array("http://google.com","http://yahoo.com","http://www.msn.com","http://www.bing.com");
   document.writeln('<table>');

   for (i=0;i<=openURL.length-1;i++){
      document.writeln('<tr><td>openURL[i]</td></tr>');
   }
   document.writeln('</table>');
}
</script>
</HEAD>
<body onload="addtext()">
</BODY>
</HTML>


Here's the ouput:
Code: Select all
openURL[i]
openURL[i]
openURL[i]
openURL[i]


It should display:
Code: Select all
http://google.com
http://yahoo.com
http://msn.com
http://bing.com


Any comments or suggestions are greatly apprecitated.
thanks
hiyatran
 
Posts: 18
Joined: Mon Jun 21, 2010 1:53 am

Who is online

Users browsing this forum: No registered users and 6 guests