Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
HTML
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Events== Events are notifications that occur as a result of user actions or state changes within a document or window. The user generates events by moving or clicking the mouse. Document state changes that can fire events include the loading of the document, the occurrence of an error or the changing of focus. HTML documents are structured documents with a defined containership hierarchy. '''Event bubbling''' is the generic capability for all actions to follow this hierarchy. When an event occurs it fires first on the source element and then on the source’s parent element and so on until it reaches the document element. All elements on the page even P, H1, etc. do fire events. In addition to event bubbling many events have '''default actions'''. A default action is what a browser normally does as a result of an event, for example loading a page for a link <A HREF...>. It is possible to override the default action. The default action can be performed by the parent element. If the child already cancels the the action the default action of the parent will not be called. Event bubbling and default actions are different concepts and can be controlled differently. '''Event Binding''' is the association between a specific event and a script. In DHTML all the elements within a document have been extended to support keyboard and mouse events. These events are exposed as attributes directly on each element, allowing a direct association between the element and the behavior. For example you can bind the onclick event of a button to a function using the attribute as follows : '''<input type=button value='''"Click Here" '''onclick="'''foo();" '''language='''"JavaScript"'''>''' The called funtion has to be declared before. The disadvantage of this approach is that the event attribute is part of the HTML standard which has to be extended for every new attribute. Another binding mechanism overcomes this disadvantage. It uses a script extension like in the following example: '''<script for="'''document"''' event="'''onmousemove()" '''language="'''JavaScript"'''>''' <code>'''</script>''' Java Script is case sensitive for the event and for attribute values. The NN ignores the two attributes and executes the code at once . The parantheses after the function name are optional. Events are also available as properties of DHTML objects. These events can be assigned to a function pointer. The functions have access to the object, which have an appropriate event handler through the this construct and access to the element, which fired the element through the srcElement construct.
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width