JavaScript Resources

Case Sensitivity in Event Handlers

As an attribute of an html tag, an event handler is considered to be html. As a result, like all html, it is not case sensitive.

It is customary, though, to use the interCap method to make it easier to identify them when editing.

    <img src="smiley.gif" onClick="alert('Hey!')" />

The JavaScript executable statements, however, are always case senstive. So, the code that you want to execute, i.e. the commands within double quotes and bolded in the above example is always case sensitive. If you change alert to ALERT, it will produce an error.

Note: 'Hey!' is not bolded above because it is not really case sensitive. Changing 'Hey!' to 'HEY!' will not cause the script to fail, but it will, however, display differently in the alert box to the user. So, technically, case matters here too, but that depends on what you are trying to convey to your user -- not to JavaScript.

Next up ... multiple statements to an event handler