JavaScript Programming: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Hints and tips for Javascript programming. | Hints and tips for Javascript programming. | ||
* Deleting options in a select element (in a form): | |||
* '''Deleting options in a select element (in a form):''' | |||
document.my_form.my_select.options[index] = null; | document.my_form.my_select.options[index] = null; | ||
Line 8: | Line 9: | ||
* Outputting quickly (for debugging) an array: | * '''Outputting quickly (for debugging) an array:''' | ||
alert(my_array); | alert(my_array); | ||
will display all the elements of the array, separated by commas. | will display all the elements of the array, separated by commas. |
Revision as of 17:23, 14 February 2007
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.