Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ On event processing browser compatibility notes     - Python2.7.7 source code analysis (Programming)

- Kubuntu 14.04 desktop to the user how to upgrade KDE 4.13.2 (Linux)

- Linux operating system log system (Linux)

- 11 you Linux Terminal Command (Linux)

- I use the desktop environment in GNU / Linux combination tool (Linux)

- How to install Ubuntu applications Device 7 (Linux)

- Linux_Logo - output color ANSI Linux distributions logo command-line tool (Linux)

- Let Ubuntu 14.04 Save screen luminance value (Linux)

- Android View event delivery (Programming)

- C ++ complex class of operator overloading (Programming)

- Linux Services Comments (Linux)

- Unix system security configuration (Linux)

- Linux, set and view environment variables (Linux)

- RPM package management under Linux (Linux)

- Hutchison DG standby database CPU consumption reached bottleneck repair (Database)

- Ubuntu PPA install SMPlayer 14.9 (Linux)

- Linux can modify the maximum number of open files (Linux)

- The difference between VMware virtual machine network mode (Linux)

- How to create a binary distribution with Bash (Linux)

- Repair fatal error in Linux: lame / lame.h: No such file or dir Error (Linux)

 
         
  On event processing browser compatibility notes
     
  Add Date : 2018-11-21      
         
         
         
  Spit first few browser compatible slot, after all, this area has just learning, not alone to say. Most of the front end of the main development should be based on the Firefox browser, in addition to easy to use firebug, Firefox strict parsing is the main reason. In addition Safari, Opera, Chrome, IE is of course not be neglected major browsers that support W3C standards are not identical. Speaking of the main differences, IE can be considered as a class, the other classified as a class. Because IE is often a very different, not to mention Quirks mode.

1.Event objects

Event objects belong to HTML DOM, on behalf of the state of events. But IE Event objects are treated as property of the Window object, use of the Event object is cross-browser compatible way:

function eventHandleFunction (evnt) {
      var theEvent = evnt evnt:? window.event;
      // ...
}

2. Event bubbling

 Event bubbling is simply child elements of an event is triggered, by default the parent element's event will be triggered in succession. We want to stop event bubbling for Mozilla browsers stopPropagation method, and IE browser uses cancleBubble property. Prevent bubbling compatible wording is:

function stopEvent (evnt) {
    if (evnt.stopPropagation) {
          evnt.stopPropagation ();
    } Else {
          evnt.cancleBubble = true;
    }
}

3. Add a listener function

 JavaScript provides three methods to achieve the object event listener: addEventListener, removeEventListener, dispatchEvent.

addEventListener usage:

obj.addEventListener ( 'event', eventFunction, boolean);

The third parameter is false, the form of bubbling event. Value is the opposite, that my late father son after anti-bubbling order of true.

But IE seems not the same, IE does not support the above method (I do not know the future will not support), a similar procedure is attachEvent, detachEvent. Compatible for event listener approach is:

if (obj.addEventListener) {
    obj.addEventListener ( "click", clickFunc, false);
} Else if (obj.attachEvent) {
    obj.attachEvent ( "onclick", clickFunc);
} Else {
    obj.onclick = clickFunc;
}
     
         
         
         
  More:      
 
- RM Environment Database RMAN Backup Strategy Formulation (Database)
- Get basic information about Linux server script (Server)
- Debugging with GDB tool Go (Programming)
- Java heap (Heap) and stack difference (Programming)
- Ubuntu 15.04 installation MATE 1.10 (Linux)
- Ubuntu installation 2.10.x version of Scala (Linux)
- Python3 multi-thread download codes (Programming)
- Android Service service applications and the phone SMS Listener Listener (Programming)
- 64-bit Windows Server 2012 R2 install Oracle 10g Second Edition (Database)
- J2EE Example of Filter (Programming)
- Binary tree and some basic operations with binary list (Programming)
- Linux kernel RCU (Read Copy Update) lock Brief (Linux)
- High-performance open-source http accelerator Varnish introduce (Server)
- stat - Get more information than ls (Linux)
- NET Developers need to know some Linux commands (Linux)
- Using FTPClient to upload and download files in Java (Programming)
- Construction Spark source and application development environment (Server)
- Installation Enpass secure password manager on Ubuntu (Linux)
- Linux centos rm directory does not prompt (Linux)
- Father of Python: Why Python zero-based index (Programming)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.