Ajax Compatibility Issues

To resolve compatibility issues first note the following:

1, document.getElementById alternative document.all (ie applicable)
2, a set of [] Alternatively () (IE applicable)
. 3, an alternative target srcElement; parentNode Alternatively parentElement (parentNode ie applicable)
. 4, node.parentNode.removeChild (Node) substitute removeNode (this) (ie applicable)
. 5, an alternative DOMMouseScroll onmousewheel; -e.detail Alternatively event.wheelDelta
. 6, the addEventListener alternative attachEvent; removeEventListener Alternatively detachEvent
7e.preventDefault () Alternatively event.returnValue = false; e.stopPropagation () event alternative = to true .cancelBubble
. 8, style.top, style.left strict inspection, etc. "px" units (plus "px" ie applicable)
. 9, style = "- Opacity of MOZ-: 0.9" alternative style = "filter: alpha (opacity = 90) "; no other filter
10, style.cursor =" pointer "Alternatively style.cursor =" hand "(ie applicable)
. 11, title alternatives alt (ie applicable)
12. All references in this space to be upon reference: document.getElementById ( "XX").

Note: marked "ie applicable" are generic recommendations written, Not indicated does not apply ie inside.

In AJAX, if the network or remote server interruption, what happens? In fact, there are two major problems; by default, they are not resolved in the XMLHttpRequest object. The two main questions are:


1. processing delays: If the network or remote server takes more time, then the problem associated with how your AJAX application?

2. response order: Potentially, the network (or server) will continue to change. This means that, in response to the request may not return to the same order.

To deal with both of these questions, the programmer must write code to solve this problem. For the first problem, one possible solution is as follows:

              function callInProgress (XMLHTTP) {
 Switch (xmlHttp.readyState) {
  Case l, 2,3:
   return to true;
   BREAK;
   // Case. 4 and 0
  default:
   return to false ;
   BREAK;
 }
}      

Now, before calling send (), I can check whether it is in a busy state of the object:

              (! CallInProgress (XMLHTTP)) {IF
 xmlhttp.send (null);
} the else {
 Alert ( "the I'm BUSY the Wait. Moment A ");
}      

Guess you like

Origin www.cnblogs.com/LiWenYi/p/11204970.html