Bonjour,

j'essai de créer un Popup ayant un contenu issue d'une requête XMLHttpRequest().

Cela fonction bien.
Cependant je souhaite en plus mettre le nom de la fenêtre Popup en variable (ceci me permettant l'affichage de multiple Popups à des fin de comparaisons. Ces popup affichant des graphes).

J'ai donc passé le nom du Popup en variable (name), mais quelque soit la syntaxe j'ai toujours le message invalid argument.
J'avoue tourner en rond..... et je ne parvient pas à trouver la syntaxe correct.
Pourriez vous m'aider ?

Merci


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<script type="text/javascript">
function SendRequest() {
  prjname='PRJ1-SIM01-XA231   ';
  var target_url="/cgi-bin/CPCPCGRF";
var request_methode="POST";
var xhr_object = prjname;                                       
  if(window.XMLHttpRequest) 
     xhr_object = new XMLHttpRequest();
  else if(window.ActiveXObject)
     xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
  else { 
     alert("Your browser does not support XMLHttpRequest.");
     return;
  }
  xhr_object.open(request_methode, target_url, true);
  xhr_object.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xhr_object.send(prjname);
  xhr_object.onreadystatechange = function() {
     if(xhr_object.readyState == 4 && xhr_object.status == 200){
       var obj_return=xhr_object.responseText;
       Popup(obj_return,prjname);
      }
  }
    return xhr_object;
}
/*-------- generation du popup ------------------*/
function Popup(grf,name) {
   alert(name);
   myWIn = open("",name,
            "width=500,height=400,status=no,toolbar=no,menubar=no,resizable=yes,directories=no,location=no");
   myWin.document.open();
   myWin.document.write('<html><head>');
   myWin.document.write('<script>');
   myWin.document.write('function HideLine(){');
   myWin.document.write(' document.getElementsByName("CPgraphe")[0].chart.setOverlayChartOn(0,document.getElementById("DC").checked);');
   myWin.document.write(' document.getElementsByName("CPgraphe")[0].chart.setOverlayChartOn(1,document.getElementById("IMSU").checked);');
   myWin.document.write(' document.getElementsByName("CPgraphe")[0].chart.setOverlayChartOn(2,document.getElementById("R4H").checked);');
   myWin.document.write(' document.getElementsByName("CPgraphe")[0].chart.setOverlayChartOn(3,document.getElementById("BIL").checked);');
   myWin.document.write('}');
   myWin.document.write('function HideSerie(NumSerie) {');
   myWin.document.write('  var Chart = document.getElementsByName("CPgraphe");');
   myWin.document.write('  if (Chart[0].chart.isSeriesLineOn(0)==true) {');
   myWin.document.write('    Chart[0].chart.setStackedOn(false);');
   myWin.document.write('    Chart[0].chart.setSeriesLineOn(0,false);');
   myWin.document.write('  } else {');
   myWin.document.write('    Chart[0].chart.setStackedOn(true);');
   myWin.document.write('    Chart[0].chart.setSeriesLineOn(0,true);');
   myWin.document.write('  }');
   myWin.document.write('}');
   myWin.document.write('function HideRefSerie(NumSerie) {');
   myWin.document.write('  var Chart = document.getElementsByName("CPgraphe");');
   myWin.document.write('  if (Chart[0].chart.isSeriesLineOn(NumSerie)==true) {');
   myWin.document.write('    Chart[0].chart.setSeriesLineOn(NumSerie,false);');
   myWin.document.write('  } else {');
   myWin.document.write('    Chart[0].chart.setSeriesLineOn(NumSerie,true);');
   myWin.document.write('  }');
   myWin.document.write('}');
   myWin.document.write('<\/script>');
   myWin.document.write('<\/head>');
   myWin.document.write('<body>');
   myWin.document.write(grf);
   myWin.document.write('<\/body>');
   myWin.document.write('<\/html>');
   myWin.document.close();
}
</script>
</head>
<body>
<input type="button" value="Start" onclick="SendRequest()">
</body>
</html>