Create Javascript Array List
How to Create Javascript Array List
Create Javascript Array List in html page by using javascript programming is easy task.As we know that Js is a client side scripting language.In this site you get all Example Related to the Asp.net Programming.In Asp.net development we need many time this code.Declare Create Array list by javascript.
For Creating a JavaScript Array list here we make page_load event on page and in this event write javascript code.Js Execute at client end so it is fast.For this first create a variable in here with Name myArraylist.Arraylist is a class in javascript ,now we create a object of Arraylist.
dim myArraylist=New ArrayList
here dim is a keyword.
<script runat="server">
Sub Page_Load
if Not Page.IsPostBack then
dim myArraylist=New ArrayList
myArraylist.Add("Norway") // Adding first element in array list.
myArraylist.Add("Sweden") // Adding Second element in array list
myArraylist.Add("France") // Adding Thred element in array list
myArraylist.Add("Italy")
myArraylist.TrimToSize()
myArraylist.Sort()
end if
end sub
</script>
Display Array list by javascript
Once Array list is create the we need to display this list by javascript language.sub displayMessage(s as Object,e As EventArgs)
for( dim i=0;i < myArraylist.length;i++)
alert(myArraylist[i] +"at index of"+ i);
end sub
Description of Example of Array list by javascript :
In this Example we want to create a list of countries in javascript Array list,First we create array list object then we insert element in this array one by one.After Createing this we want to display this Array list.Other Post :
- use-of-file-upload-control-in-asp.net.
- code-for-java-script-validation-in
- how-to-add-calendar-with-textbox-in.
- how-to-make-cyrstel-report-in-asp.net.
- hidden-field-in-grid-view-in-asp.net
- how-to-to-set-date-format-in-to.html
- how-to-set-current-data-into-asp-text
- web-services-in-asp.net-programming.
- declare-pointer-in-asp.net-programming
- data-type-in-c-with-asp.net-programming
- introduction-of-c-csharp-also-know-asc.
Related Post of Javascript:
- change-value-of-literal-control-by.html
- access-literal-control-using-javascript.html
- literal-control.html
- display-elements-on-button-clicked.html
- hide-radio-buttons-in-javascript-on.html
- show-and-hide-div-by-javascript.html