1/* 2Versione 20130308 3strURL=url da caricare nel div 4form_name=nome del form 5div_id= id del div da caricare 6num_campi= numero di campi nel form (form_field_0 -> form_field_n) 7id1= id del div da nascondere temporeamente 8id2= id del div da mostrare temporaneamente (attendere) 9basefield = nome di base per più form conteporanemente 10*/ 11function xmlhttpPost( strURL, form_name, div_id, num_campi, id1, id2, basefield ) 12{ 13 14 /* funzioni per nascondere o visualizzare un div */ 15 var elemento1 = document.getElementById( id1 ); 16 var elemento2 = document.getElementById( id2 ); 17 elemento1.style.display = (elemento1.style.display == 'none') ? '' : 'none'; 18 elemento2.style.display = (elemento2.style.display == '') ? 'none' : ''; 19 20 21 var xmlHttpReq = false; 22 var self = this; 23 // Xhr per Mozilla/Safari/Ie7 24 if (window.XMLHttpRequest) 25 { 26 self.xmlHttpReq = new XMLHttpRequest(); 27 } 28 // per tutte le altre versioni di IE 29 else if (window.ActiveXObject) { 30 self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 31 } 32 self.xmlHttpReq.open('POST', strURL, true); 33 self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 34 self.xmlHttpReq.onreadystatechange = function() 35 { 36 if (self.xmlHttpReq.readyState == 4) 37 { 38 updatepage(self.xmlHttpReq.responseText, div_id ); 39 } 40 } 41 self.xmlHttpReq.send( getquerystring( form_name, num_campi, basefield ) ); 42} 43 44function getquerystring( form_name, num_campi, basefield ) 45{ 46 var form = document.forms[form_name]; 47 var btn_form = form.btn_form.value; 48 qstr = 'btn_form=' + escape(btn_form); // NOTARE bene che non viene messo '?' prima della querystring 49 50 for( i=1; i<=num_campi; i++ ) 51 { 52 var f_id = basefield + 'form_field_' + i; 53 var field = document.getElementById( f_id ); 54 //var f_value = field.value.replace( /&/g, escape('&') ); 55 var f_value = encodeURIComponent(field.value); // uso encodeURIComponent per codificare i parametri dell'url 56 var f_name = field.name; 57 qstr = qstr + '&' + f_name + '=' + f_value; // NOTARE bene che non viene messo '?' prima della querystring 58 } 59 return qstr; 60} 61 62function updatepage( str, div_id ) 63{ 64 document.getElementById( div_id ).innerHTML = str; 65}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.