Skip navigation.

3.3 Use JavaScript wisely

Examples

A script is present that displays a colour picker. Poor noscript: sorry your browser... Good noscript: a list of links for choosing colours

..OnClick="f1()" OnKeypress="f1()"...

...OnMousedown="f2()" OnKeydown="f2()"..

..OnMouseup="f3()" Onkeyup="f3()"...

Device independent event handlers OnFocus, OnBlur, OnSelect would be the preferred way to detect events, unfortunately current browser support is patchy at best.