1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject();
Function Event_when_input_is_changed() {
var param = document.getElementById('Ton_input').value;
http.open("GET", "page.php?ajout=" + escape(param), true);
http.onreadystatechange = function() {
if (http.readyState == 4) {
var results = http.responseText;
if (!results) {
alert('Echec');
} else {
document.getElementById('mon_select').options[document.getElementById('mon_select').lenght] = new Option(une_clé, param);
}
}
}
} |
Partager