Theme Layout

Boxed or Wide or Framed

Wide

Theme Translation

Display Featured Slider

Featured Slider Styles

Display Grid Slider

yes

Grid Slider Styles

Display Trending Posts

Display Author Bio

Display Instagram Footer

off

Dark or Light Style

Light

Blog Archive

Powered by Blogger.

Saturday, February 11, 2017

[JavaScript] Events


# JavaScript Objects


● JavaScript Events

 HTML events are "things" that happen to HTML elements.
 When JavaScript is used in HTML pages, JavaScript can "react" on these events.

● HTML Events

 An HTML event can be something the browser does, or something a user does.

 Here are some examples of HTML events.
  • An HTML web page has finished loading
  • An HTML input field was changed
  • An HTML button was clicked
 When events happen, I may want to do something.
 JavaScript lets user execute code when events are detected.
 HTML allows event handler attributes, with JSP code, to be added to HTML elements.
 
 With single quotes 
  <some-HTML-element some-event='some JavaScript'> 
 or with double quotes
  <some-HTML-element some-event="some JavaScript">

 In the below example, an onclick attribute, is added to a button element.


In the example above, The JavaScript code changes the content of the element with id="prac".
In the next example, the code changes the content of its own element(this.innerHTML).


JSP code is often several lines long. It is more common to see event attributes calling functions.

● Common HTML Events

 Here is a list of some common HTML events.

http://www.w3schools.com/js/js_events.asp

● JavaScript can do!

 Event handlers can be used to handle, and verify, user input, user actions, and browser actions.
  • Things that should be done every time a page loads
  • Things that should be done when the page is closed
  • Action that should be performed when a user clicks a button
  • Content that should be verified when a user inputs data
  • And more ...
 Many different methods can be used to let JSP work with events.
  • HTML event attributes can execute JavaScript code directly
  • HTML event attributes can call JavaScript functions
  • You can assign your own event handler functions to HTML elements
  • You can prevent events from being sent or being handled
  • And more ...
QuickEdit
Unknown
0 Comments
Share This Post :

You Might Also Like

No comments:

Post a Comment

Follow @SunriseSunsetBlog