| 119 |
ghuddy |
1 |
<!--
|
|
|
2 |
|
|
|
3 |
var xmlHttp;
|
|
|
4 |
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0;
|
|
|
5 |
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0;
|
|
|
6 |
var is_opera = ((navigator.userAgent.indexOf("Opera6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0;
|
|
|
7 |
//netscape, safari, mozilla behave the same???
|
|
|
8 |
var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0;
|
|
|
9 |
var ajaxdivname;
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
//stateChangeHandler will fire when the state has changed, i.e. data is received back
|
|
|
14 |
// This is non-blocking (asynchronous)
|
|
|
15 |
function stateChangeHandler()
|
|
|
16 |
{
|
|
|
17 |
|
|
|
18 |
//readyState of 4 or 'complete' represents that data has been returned
|
|
|
19 |
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete'){
|
|
|
20 |
//Gather the results from the callback
|
|
|
21 |
var str = xmlHttp.responseText;
|
|
|
22 |
|
|
|
23 |
//Populate the innerHTML of the div with the results
|
|
|
24 |
MM_findObj( ajaxdivname ).innerHTML = str;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
//stateComboChangeHandler will fire when the state has changed, i.e. data is received back
|
|
|
31 |
// This is non-blocking (asynchronous)
|
|
|
32 |
function stateComboChangeHandler()
|
|
|
33 |
{
|
|
|
34 |
//Expected response data: text|-|value|-|selected|+|text2|-|value2|-|selected2
|
|
|
35 |
|
|
|
36 |
//readyState of 4 or 'complete' represents that data has been returned
|
|
|
37 |
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete'){
|
|
|
38 |
//Gather the results from the callback
|
|
|
39 |
var str = xmlHttp.responseText;
|
|
|
40 |
var combo = ajaxdivname ;
|
|
|
41 |
var lastOption = combo.options.length
|
|
|
42 |
|
|
|
43 |
//Remove current Combo options
|
|
|
44 |
for (i=0; i<lastOption; i++)
|
|
|
45 |
{
|
|
|
46 |
combo.options[0] = null;//The combo box re-organizes itself therefore remove the first element
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
//Populate combowith new items
|
|
|
50 |
var optionArray = str.split('|+|');
|
|
|
51 |
|
|
|
52 |
for (i in optionArray)
|
|
|
53 |
{
|
|
|
54 |
//alert(optionArray[i]);
|
|
|
55 |
var opt = optionArray[i].split('|-|');
|
|
|
56 |
combo.options[i] = new Option( opt[0], opt[1], opt[2] );
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
// XMLHttp send GET request
|
|
|
65 |
function xmlHttp_Get(xmlhttp, url) {
|
|
|
66 |
xmlhttp.open('GET', url, true);
|
|
|
67 |
xmlhttp.send(null);
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
function GetXmlHttpObject(handler) {
|
|
|
71 |
var objXmlHttp = null; //Holds the local xmlHTTP object instance
|
|
|
72 |
|
|
|
73 |
//Depending on the browser, try to create the xmlHttp object
|
|
|
74 |
if (is_ie){
|
|
|
75 |
//The object to create depends on version of IE
|
|
|
76 |
//If it isn't ie5, then default to the Msxml2.XMLHTTP object
|
|
|
77 |
var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP';
|
|
|
78 |
|
|
|
79 |
//Attempt to create the object
|
|
|
80 |
try{
|
|
|
81 |
objXmlHttp = new ActiveXObject(strObjName);
|
|
|
82 |
objXmlHttp.onreadystatechange = handler;
|
|
|
83 |
}
|
|
|
84 |
catch(e){
|
|
|
85 |
//Object creation errored
|
|
|
86 |
alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled');
|
|
|
87 |
return;
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
else if (is_opera){
|
|
|
91 |
//Opera has some issues with xmlHttp object functionality
|
|
|
92 |
alert('Opera detected. The page may not behave as expected.');
|
|
|
93 |
return;
|
|
|
94 |
}
|
|
|
95 |
else{
|
|
|
96 |
// Mozilla | Netscape | Safari
|
|
|
97 |
objXmlHttp = new XMLHttpRequest();
|
|
|
98 |
objXmlHttp.onload = handler;
|
|
|
99 |
objXmlHttp.onerror = handler;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
//Return the instantiated object
|
|
|
103 |
return objXmlHttp;
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
//-->
|