BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
JavaScript
JavaScript Variables
How to use JavaScript?
JavaScript Guidelines
Stock sorter example for IE5
Confused about how to use a data island in IE5??
Software Release tracking application
Employee Phonebook dataisland
Multitab DHTML browser
Trim function in Javascript
Multiple Grid
Re: Trim Function in JavaScript
Re: Trim Function in JavaScript
Trim Function in JavaScript using Regular Expressions.
DHTML ScoreBoard Behavior
Re: JScript Super Class To Handle XML Transformations
Updated: Detect XML Parser version using Javascript
XML Cache using IE 5.0 Behaviour
XML cache on client for the desktop application website
Javascript XML element listing
Sorting Data Islands by clicking on the column header (using behaviors).
 
LAMP >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :636

 

JavaScript Arrays

Introduction

Arrays are variables, which can contain multiple values. The difference is that it is only “one” array, which will store these values. If you needed to store multiple values in normal variables, then you would have to define multiple variables. Usually arrays are associated with numbers, which starts with 0. If you create an array for 4 elements, then the first one will be 0, the second 1, the third 2 and so on. Arrays are created always with the new keyword. Arrays are useful if are for example creating a calendar. You could store the months in an array.

Assigning Values

The values can be assigned in two ways. Either without defining the size and index or by defining the size and index number. The following creates two arrays with each 12 elements.

var arCalendarMonths = new Array("January", "February", "March", "April", "May", "April", "June", "July", "August", "September", "October", "November", "December")

var arCalendarMonths = new Array(11)

arCalendarMonths[0] = "January"

arCalendarMonths[1] = "February"

arCalendarMonths[2] = "March"

arCalendarMonths[3] = "April"

arCalendarMonths[4] = "May"

arCalendarMonths[5] = "June"

arCalendarMonths[6] = "July"

arCalendarMonths[7] = "August"

arCalendarMonths[8] = "September"

arCalendarMonths[9] = "October"

arCalendarMonths[10] = "November"

arCalendarMonths[11] = "December"

Example

<html>

<head>

<script type="text/javascript">

            var arCalendarMonths = new Array(11)

            arCalendarMonths[0] = "January"

            arCalendarMonths[1] = "February"

            arCalendarMonths[2] = "March"

            arCalendarMonths[3] = "April"

            arCalendarMonths[4] = "May"

            arCalendarMonths[5] = "June"

            arCalendarMonths[6] = "July"

            arCalendarMonths[7] = "August"

            arCalendarMonths[8] = "September"

            arCalendarMonths[9] = "October"

            arCalendarMonths[10] = "November"

            arCalendarMonths[11] = "December"

            for(var i=0;i<arCalendarMonths.length;i++)

            {

                        var month = i + 1

                        document.write("Month" + month + ": " + arCalendarMonths[i]+ "<br/>")

            }

</script>

</head>

<body></body>

</html>

Output

Functions

The Array object contains total 10 functions. We have grouped all 10 functions together in a new page with each an example and a screenshot. Please visit that page for more information about the functions.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
spoc
swimming pool contractor
teleconferencing service
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP