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 44 45 46 47
| <script language="JavaScript">
function createGraph() {
var xhr = getXhr();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
var leselect = xhr.responseText;
document.getElementById('level5').innerHTML = leselect;
}
}
var newDateFirst;
var newDateLast;
var selectedList_level3 = new Array();
xhr.open("POST","displayGraph.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
var dateFirst = document.getElementById('idDateFirst').value;
var dateLast = document.getElementById('idDateLast').value;
//change date format for later comparison
try{
checkDateFirst=dateFirst.split("/");
newDateFirst=checkDateFirst[2]+checkDateFirst[1]+checkDateFirst[0];
checkDateLast=dateLast.split("/");
newDateLast=checkDateLast[2]+checkDateLast[1]+checkDateLast[0];
} catch(e) {}
//selection from level3
var sel_level3 = document.getElementById('level3').getElementsByTagName('SELECT');
for (var i=0; i<sel_level3.length; i++) {
for (var j=0; j<sel_level3[i].options.length; j++) {
if (sel_level3[i].options[j].selected) {
selectedList_level3.push(sel_level3[i].options[j].value);
}
}
}
//selection from level4
var sel_level4 = document.getElementById('sel_level4');
var repGraph= sel_level4.options[sel_level4.selectedIndex].value;
if (newDateFirst<newDateLast) {
xhr.send("sellevel3="+selectedList_level3.toString()+"&typeRepGraphique="+repGraph+"&dateFirst="+dateFirst+"&dateLast="+dateLast+"&dateErr=no");
}
else {
xhr.send("typeRepGraphique="+repGraph+"&dateFirst="+dateFirst+"&dateLast="+dateLast+"&dateErr=yes");
}
}
</script> |
Partager