A voir également:
- Menu déroulant sous IE
- Menu déroulant excel - Guide
- Excel menu déroulant en cascade - Guide
- Menu déroulant google sheet - Accueil - Guide bureautique
- Windows 11 menu démarrer classique - Guide
- Supprimer menu déroulant excel - Forum Excel
1 réponse
ezo_es
Messages postés
100
Date d'inscription
dimanche 1 mars 2009
Statut
Membre
Dernière intervention
16 mars 2010
9
12 mars 2009 à 12:46
12 mars 2009 à 12:46
Bonjour
peusx tu nous envoyer le code ?
peusx tu nous envoyer le code ?
12 mars 2009 à 13:38
<body onload= "send_request_to_server('type=country','../db_requests/refresh_list.php',['nr_menu','country_table'])">
le refresh_list.php est comme suit:
if($_POST['type']=='operator'){
$searched_country = $_POST['country'];
$sql_result = read_table(array ("operator"),array("plmn"),array(array("country","=",$searched_country," ")),array(" ORDER BY ","operator","ASC"));
}
else {
$sql_result = read_table(array ("country"),array("plmn"),null,array(" GROUP BY ","country","ASC"));
}
// Format sql result
$display_list = format_result($sql_result,$_POST['type'],'fieldset');
echo ($display_list);
et le send_request_to_server:
function send_request_to_server(request_parameter, url, display_destination){
var http_request = get_xhr();
var reg = new RegExp('\\?',"g"); //'GET'
if (!http_request) {
alert('Abandon : Unable to create XMLHTTP instance');
return false;
}
// Define function to process data return by the request
http_request.onreadystatechange = function() {
display_server_results(http_request, display_destination);
}
if (url.match(reg)){
// Request Launch
http_request.open("GET",url,true);
http_request.send(null);
}
else {
// Opening server connection for request
http_request.open('POST', url, true);
// Change MIME type to use with POST method. NB: This line must be after Request Launch
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send(request_parameter);
//alert(request_parameter);
}
}
/****************************************************************************************************
* Function Name:
* display_server_results
* Parameters:
* http_request = returned data from server
* display_destination = frame where to write + target destination in web page to show results
* Behaviour:
* This functon create the
* XMLHttpRequest object
* depending on browser type.
*****************************************************************************************************/
function display_server_results(http_request, display_destination) {
var display_list1="";
var display_list2="";
var display_list3="";
reg = new RegExp("google_map_window","g");
reg2 = new RegExp("cell_info_table","g");
reg3 = new RegExp("operator_table","g");
reg4 = new RegExp("general_infos_table","g");
if (http_request.readyState == 4) {
if (http_request.status == 200) { // Server Return Code: 200=OK, 404=Not Found
if (display_destination[1].match(reg)){ // destination=google_map_window
// PHP response in text mode
display_list1 = http_request.responseText;
draw_polygon(display_list1);
}
else{//we write in the div
if (display_destination[1].match(reg2) || display_destination[1].match(reg3)){// destination=cell_infos_table or operator_table
// Received data are loaded in list
display_list3 = http_request.responseText;
// List is displayed in the target fieldset
obj = parent.frames[display_destination[0]].document.getElementById(display_destination[1]);
obj.innerHTML = display_list3;
}
else{
// Received data are loaded in list
display_list2 = http_request.responseText;
// List is displayed in the target fieldset
obj = parent.frames[display_destination[0]].document.getElementById(display_destination[1]);
obj.innerHTML = obj.innerHTML + display_list2;
}
}
}
else{
alert('Request Failed. Sorry for inconvenience');
}
}
}
Voilà j'espère que c'est clair pour vous :s
12 mars 2009 à 13:47
12 mars 2009 à 14:33