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
Newer Posts
Older Posts
Home
Subscribe to:
Posts (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...
Expand/Collapse Rows Dynamically with DOM and JavaScript
Suppose, you have a table structured as follows: The first line for a new month is always a total of the project amounts. This structu...
"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...
A Simple Way to Highlight Table Cells with JavaScript
Highlight Table Rows on Mouseover To highlight whole rows, use the following function: function hiLiteRows(){ var table = document.get...
Extract Table Text
The following recursive function can be used to extract text from any HTML element including a table. var cnts= ''; function getEl...
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
All Comments
Atom
All Comments
Total Pageviews