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
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...
Highlight HTML Table Rows with JavaScript
Highlight Table Rows on Mouseover To highlight whole rows, use the following function: function hiLiteRows(){ var table = document.get...
"Event is Not Defined" Error in Firefox
This error may occur when you try to attach a JavaScript function dynamically to page elements and pass an event to the function. An example...
Hide Columns in Table
To hide or show table columns, first we get a reference to the table var table = document.getElementsByTagName("table")[0]; The...
Toggle Enabled State on Submit Button from Checkbox with jQuery
$ ( " #myCheckBox " ) . change ( function ( ) { $ ( " input[type='submit'] " ) . prop ( " disab...
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