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