skip to main
|
skip to sidebar
JavaScript Tips
This blog features pure JavaScript code. You don't need to use libraries to do stuff in JavaScript.
Wednesday, May 20, 2009
Enumerate Array or Object
This is how you could enumerate properties of a JavaScript array:
var arr = ['a', 'b', 'c'];
for (var prop in arr)
alert (prop + ":"+ arr[prop]);
Result:
0:a
1:b
2:c
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Search This Blog
Categories
Array
Books
Cookies
DOM
Form
Functions
jQuery
Table
Pages
Home
Expand Table Rows Demo
Numbers Only Demo
Dynamic Drop-Down Box (Part 1)
Delete Rows Demo
Dynamic Drop Down Box (Part 2)
Dynamic Drop-Down Box (Part 3)
Popular Posts
Extract Table Text
The following recursive function can be used to extract text from any HTML element including a table. var cnts= ''; function getEl...
A JavaScript Function that Allows Only Numbers
This little function will force users to type numbers, commas and periods only. function noAlpha(obj){ reg = /[^0-9.,]/g; obj.value = o...
How to Change HTML Table Cell Value
First, we need to get a reference to a table cell value. var table = document.getElementById('myTableId'); An HTMLTableElement has...
A Script That Remembers Values Typed into a Text Box
HTTP cookies can be used both for server-side and client-side programming. There are many ways to use cookies in Javascript. In this short...
(no title)
A JavaScript endsWith function The following JavaScript function checks whether a string ends with a specified string. function endsWith...
About Me
Erik K.
Toronto, Ontario, Canada
View my complete profile
Useful Links
A good explanation of the this keyword in JavaScript
Simple Tabs
Fading Tutorial
Blog Archive
►
2015
(1)
►
May
(1)
►
2014
(1)
►
March
(1)
►
2012
(11)
►
September
(1)
►
May
(1)
►
March
(6)
►
February
(3)
►
2011
(3)
►
June
(1)
►
May
(2)
►
2010
(2)
►
December
(1)
►
November
(1)
▼
2009
(3)
►
December
(1)
▼
May
(1)
Enumerate Array or Object
►
March
(1)
Subscribe To
Posts
Atom
Posts
Comments
Atom
Comments
Total Pageviews
No comments:
Post a Comment