Magellan Linux

Diff of /alx-src/branches/alx-web-050/openclose_ajax.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1609 by niro, Thu Dec 2 19:56:40 2010 UTC revision 1610 by niro, Thu Dec 2 23:02:19 2010 UTC
# Line 1  Line 1 
1  /**  /**
2   * instantiates a new xmlhttprequest object   * instantiates a new xmlhttprequest object
3   *   *
4   * @return xmlhttprequest object or false   * @return xmlhttprequest object or false
5   */   */
6  function getXMLRequester( )  function getXMLRequester( )
7  {  {
8      var xmlHttp = false;      var xmlHttp = false;
9                            
10      // try to create a new instance of the xmlhttprequest object              // try to create a new instance of the xmlhttprequest object        
11      try      try
12      {      {
13          // Internet Explorer          // Internet Explorer
14          if( window.ActiveXObject )          if( window.ActiveXObject )
15          {          {
16              for( var i = 5; i; i-- )              for( var i = 5; i; i-- )
17              {              {
18                  try                  try
19                  {                  {
20                      // loading of a newer version of msxml dll (msxml3 - msxml5) failed                      // loading of a newer version of msxml dll (msxml3 - msxml5) failed
21                      // use fallback solution                      // use fallback solution
22                      // old style msxml version independent, deprecated                      // old style msxml version independent, deprecated
23                      if( i == 2 )                      if( i == 2 )
24                      {                      {
25                          xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );                              xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );    
26                      }                      }
27                      // try to use the latest msxml dll                      // try to use the latest msxml dll
28                      else                      else
29                      {                      {
30                                                    
31                          xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );                          xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
32                      }                      }
33                      break;                      break;
34                  }                  }
35                  catch( excNotLoadable )                  catch( excNotLoadable )
36                  {                                          {                        
37                      xmlHttp = false;                      xmlHttp = false;
38                  }                  }
39              }              }
40          }          }
41          // Mozilla, Opera und Safari          // Mozilla, Opera und Safari
42          else if( window.XMLHttpRequest )          else if( window.XMLHttpRequest )
43          {          {
44              xmlHttp = new XMLHttpRequest();              xmlHttp = new XMLHttpRequest();
45          }          }
46      }      }
47      // loading of xmlhttp object failed      // loading of xmlhttp object failed
48      catch( excNotLoadable )      catch( excNotLoadable )
49      {      {
50          xmlHttp = false;          xmlHttp = false;
51      }      }
52      return xmlHttp ;      return xmlHttp ;
53  }  }
54    
55    
56  function sendopenclose(section, opened)  function sendopenclose(section, opened)
57  {  {
58   var xmlHttp = getXMLRequester();   var xmlHttp = getXMLRequester();
59    
60   if(xmlHttp!=null)   if(xmlHttp!=null)
61   {   {
62   // open the connection   // open the connection
63   xmlHttp.open( 'GET', 'openclose.php?section='+section+'&opened='+opened, true );   xmlHttp.open( 'GET', 'openclose.php?section='+section+'&opened='+opened, true );
64                    
65   // send request to server   // send request to server
66   xmlHttp.send( null );    // param = POST data   xmlHttp.send( null );    // param = POST data
67   }   }
68  }  }

Legend:
Removed from v.1609  
changed lines
  Added in v.1610