I am executing a cgi file directly from javascript onclick of a button. The cgi return the doc, xls, exe etc file which in turn opens SavaAs dialog to let the client save file on his machine. Problem comes when multiple cgi files are executing in a for/while loop, It executes only the first cgi and opens the SaveAs dialog, but once the SaveAs opens it does not enter into the "for" loop again to execute another cgi which opens SaveAs dialog .
Here is the code fragment -
for(i = 0; i < dataPopup.elements['checkbox'].length; i++)
{
j=0;
obj = dataPopup.elements['checkbox'];
if(obj[i].checked)
{
var temp=obj[i].value;
temp = temp.split(".");
if(temp[1] == "txt")
{
saveWins[temp[1]] = setTimeout("document.location='../cgi/saveTextFile.cgi?fname=070319185708701_1'", 100);
}
else if(temp[1] == "pdf")
{
saveWins[temp[1]] = setTimeout("document.location='../cgi/savePdfFile.cgi?fname=065726729272220_1'", 100);
}
else if(temp[1] == "xls")
{
saveWins[temp[1]] = setTimeout("document.location = '../cgi/saveXlsFile.cgi?fname=288433243743'", 100);
}
else if((temp[1] == "doc") || (temp[1] == "docx"))
{
saveWins[temp[1]] = document.location = '../cgi/saveDocFile.cgi?fname='+temp[0];
}
saveWins[temp[1]].focus();
}
}
Please Help.