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 |
|
xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" ); |
31 |
xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" ); |
} |
32 |
} |
break; |
33 |
break; |
} |
34 |
} |
catch( excNotLoadable ) |
35 |
catch( excNotLoadable ) |
{ |
36 |
{ |
xmlHttp = false; |
37 |
xmlHttp = false; |
} |
38 |
} |
} |
39 |
} |
} |
40 |
} |
// Mozilla, Opera und Safari |
41 |
// Mozilla, Opera und Safari |
else if( window.XMLHttpRequest ) |
42 |
else if( window.XMLHttpRequest ) |
{ |
43 |
{ |
xmlHttp = new XMLHttpRequest(); |
44 |
xmlHttp = new XMLHttpRequest(); |
} |
45 |
} |
} |
46 |
} |
// loading of xmlhttp object failed |
47 |
// loading of xmlhttp object failed |
catch( excNotLoadable ) |
48 |
catch( excNotLoadable ) |
{ |
49 |
{ |
xmlHttp = false; |
50 |
xmlHttp = false; |
} |
51 |
} |
return xmlHttp ; |
|
return xmlHttp ; |
|
52 |
} |
} |
53 |
|
|
|
|
|
54 |
function sendopenclose(section, opened) |
function sendopenclose(section, opened) |
55 |
{ |
{ |
56 |
var xmlHttp = getXMLRequester(); |
var xmlHttp = getXMLRequester(); |
63 |
// send request to server |
// send request to server |
64 |
xmlHttp.send( null ); // param = POST data |
xmlHttp.send( null ); // param = POST data |
65 |
} |
} |
|
} |
|
66 |
|
} |