JavaScript Programming

From Elvanör's Technical Wiki
Revision as of 17:23, 14 February 2007 by Elvanor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hints and tips for Javascript programming.

  • Deleting options in a select element (in a form):
document.my_form.my_select.options[index] = null;

Note that this syntax probably also works for other arrays of objects (untested yet, though).


  • Outputting quickly (for debugging) an array:
alert(my_array);

will display all the elements of the array, separated by commas.