Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
One important concept that you need to understand about working with handlers involves variable scope. The term scope refers to the location in a script where a variable can be seen and accessed. Variable scope varies, depending on how and where variables are declared.
By default, any variables declared inside of an event handler are local in scope. A local variable is one that can only be accessed within its current scope. Therefore, a variable that is local to a handler cannot be accessed from outside that handler.