This is the 12th day of my participation in the August More Text Challenge. For details, see: August More Text Challenge

Today’s content is important!! Do do do

Can be used as a beginner’s learning route, can refer to, learning progress is not particularly catch up! Continue to update,

With their own understanding, simple and comprehensive summary of basic knowledge, most of the content is the vernacular content, the foundation of the foundation to deepen understanding!

Consolidate the basic knowledge of learning JavaScript, deepen the understanding of memory, to build a firm foundation! Come on

Let’s get started! Take it seriously!

1. Sort out the relevant knowledge points learned yesterday

  • Built-in objects:
    • Array        reverse   pop  push  shift unshift  splice()    arr.length = 3    join
    • String     split     substr(start,length)    substring(start,end)   indexOf()   lastIndexOf()     replace()   trim()
    • Math       random()    round ceil   floor
    • DateGetMonth ()
  • BOMDOM
    • BOM : window—location  history  event  document   navigator   screen      
    • Document: Add, delete, and check page elements
      • Add: createElement appendChild insertBefore
      • Delete: remove removeChild () ()
      • Change:
        • > > < span style = “color:red” style = “color:red” style = “color:red”

        • InnerHTML innerText value

        • Change attributes

    Obj.attribute obj.getAttribute() obj.setAttribute()

    • Check:

            getElementBy….

  • Cloning: cloneNode (true)

2, event Event object

  • The eventAn action on a page element is an event
  • The event object: onclick onkeyup…. when an event is performed on a page element It generates an object and that object is called the event object.
  • Event object compatibility
var e = evt || event
Copy the code

3. Coordinate properties of mouse event objects

  • clientX/clientYHorizontal and vertical coordinates from the visible window
  • pageX/pageYHorizontal and vertical coordinates from the top and left of the document
  • offsetX / offsetYThe internal offset of a distance operation element

4, mouse event object button property

There are three cases of values:

  • Left-click 0
  • Roller 1
  • Right-click 2

Results: ie

  • Left: 1.
  • Roller: 4
  • Right: 2

5. (extension) write a function that is compatible with the value of the Button property

Evt arguments in encapsulated functions refer to event arguments

function getButton(evt) {

  var e = evt || event // Determine the browser
  if (evt) {
    / / high version
    return e.button
  } else if (window.event) {
    // Internet Explorer
    switch (e.button) {
      case 1:
        return 0
      case 4:
        return 1
      case 2:
        return 2}}}Copy the code

Everybody Go!

[Preview] : Continue to review the event object more knowledge points.. Can not eat a full fat acridine.. –

Learning is a continuous process, stick to it, there will be harvest!

Accumulate over a long period of time, consolidate the foundation, early into dafang!

It is not easy to insist, adhere to down is not easy, you really good!

Calm Down & Carry On!



Read more:

The previous article is updated and reviewed

【 re-learn JS】 every day to learn to consolidate the foundation of the series of articles, wait for you to review the classic, deepen the impression, flexible application:

[day1] js initial

[day2] Various operators,

[day3] Data type,

【day4】 Loop structure & Conditional Statement,

【day5】 Function (key),

[DAY6] Scope & Event,

【day7】 Object & Array method summary,

[day8] String methods & Partial sort,

【day9】Math object & Wrap function,

[DAY10] BOM- Browser Object Model,

【 DAY11 】DOM- Document Object Model,

More on the way… A long way to go…