Event stream

First, use the return value to change the default behavior of HTML elements
    HTML element contains most of its default behavior, such as: hyperlinks, submit buttons. We can prevent its default behavior by adding return false in a binding event.
    <a onclick='demo()'> test </a>
      function Demo () {
        code needs to be executed;
        return to false;
      }


Two, dom event listeners
    set up an event listener:
      element object .addEventListener ( "Event Type", "handler", false);
    cancel an event listener:
      element object .removeEventListener ( "Event Type", "handler", false);
    common events:
      onclick click the object is triggered
      ondblclick double-click the object is a trigger
      triggered when the mouse into an object onmouseout
      triggered when the mouse out onmousemove
      trigger onmouseover mouse out
    keyboard events:
      triggered when you press a key on the keyboard onkeydown, will continue to press the trigger has been
      onkeyup triggered when a key is released
      when onkeypress press a button and generate a trigger character, ignoring shift key features such as
    HTML event:
       after onload page is fully loaded trigger on the window object
       on the page to completely uninstall and then onunload window object triggers
       onselect selected triggered when one or more characters of the text box
       when the text box loses focus onchange, and had changed when it gets focus content trigger
       When onsubmit click "Submit" button on the form form trigger
       trigger has the focus onfocus any element or window
       when onblur any element or trigger window loses focus

 

Guess you like

Origin www.cnblogs.com/yanghaoyu0624/p/11375160.html