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:
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
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...
Delete Table Rows
To delete selected rows from a table, obviously, we need to add checkboxes to every table row. When a checkbox is checked, it means that tha...
Check Radio Button State
If you have radio buttons and one of the buttons is checked by default, you may need to check if the buttons state has been changed, and onl...
Highlight All Links on a Web Page
The following JavaScript code will highlight each html link on a web page when you hover your mouse over it. Get an array of all html link...
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...
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