Javascript Array's
2003-03-16 12:21:52
Category: javascript:general
Description: Simple array example.
Author: mind
Viewed: 6498
Rating: (24 votes)


<!-- array.js - mind (mind@metalshell.com) -->
 
<!-- pretty simple array example -->
<!-- $ If you have any problems or questions, email me $ -->
<!-- http://www.metalshell.com -->
 
<!-- put this code into the <head> section of your html document. -->
 
<!-- start our javascript -->
<script language=JavaScript>
// define our array exmp
var exmp = new Array("This", "Is", "Our", "Array");
var i;
 
// create a function
function showArray()
{
  for (i = 0; i < exmp.length; i++)
    // write out each segment of the array with each loop
    document.write('<font>' + exmp[i] + '</font><br>');
}
 
// end of our javascript
</script>
<!-- place this code anywhere on your html document (example) -->
 
<!-- align our link below -->
<div align=center>
        <!-- make a link that points to our js function printText() -->
        <a href="javascript: showArray();">Click Here!</a>
</div>