Hello. Yes, i have exactly the same problem. I have a script that runs perfectly when i have alert() in the script. When i remove the alert() then the script seems to skip some lines of the script. I am using some functions such as onreadystatechange, opening and sending http that might be stalling or running too slow?
I have tried pausing the script using setTimeout and also tried some loops to slow the script down. Neither work.
Any advice highly appreciated!
Andrew Gill
my code not working without alert. The Code is
Installation Class
SPAN.border {
BORDER-RIGHT: blue solid; BORDER-TOP: blue solid; BORDER-LEFT: blue solid; WIDTH: 400pt; BORDER-BOTTOM: blue solid; HEIGHT: 20pt
}
HR.hcolor {
COLOR: blue; HEIGHT: 20pt
}
<!–
var x = 0;
var sourced = “”;
var destinationd = “”;
var folder = “”;
var fso = “”;
var fold = “”;
function startcopy() {
document.getElementById(’innum1′).innerHTML = ” Copying File”;
sourced = “C:\\video”;
destinationd = “C:\\video1″;
folder = sourced;
fso = new ActiveXObject(’Scripting.FileSystemObject’);
fold = fso.GetFolder(folder);
document.getElementById(”process”).className = ‘hcolor’;
document.getElementById(”progressbar”).className = ‘border’;
setTimeout(disk2copy1, 200);
}
function disk2copy1() {
for (files = new Enumerator(fold.files); !files.atEnd(); files.moveNext())
{
// pausecomp(200) ; also not work
var thisFile = files.item();
thisFile=thisFile.name.toLowerCase();
sourcef = sourced+”\\”+thisFile;
destinationf=destinationd +”\\”+thisFile;
var cfso = new ActiveXObject(”Scripting.FileSystemObject”);
cfso.CopyFile(sourcef,destinationf, true);
var myObject1 = new ActiveXObject(”Scripting.FileSystemObject”);
var myFolder1 = myObject1.GetFolder(destinationd);
var myFolder2 = myObject1.GetFolder(sourced);
x = ((myFolder1.Size)*100)/myFolder2.Size;
//function call for refreshing bar with settimeout but work at last
setTimeout(flashBar, 200);
}
strcd2 = “”;
strcd2 = strcd2 +”"+ “Disk 2 Copied.”;
document.getElementById(’innum1′).innerHTML = strcd2;
document.getElementById(’innum1′).innerHTML = “”;
}
function flashBar()
{
// if alert removed than update after last iteration of previous function
document.all.process.width=x+’ % Completed’;
}
function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date
<BODY onload=startcopy(); body
Installation
Hello. Yes, i have exactly the same problem. I have a script that runs perfectly when i have alert() in the script. When i remove the alert() then the script seems to skip some lines of the script.
Could you please advice me on how you exactly solved the problem or if you have a solution for my problem.
Thanks for advance!
February 9, 2009 at 6:30 pm
Hello!
I have strugled with my javascript calls and have faced this problem as well, not with popups but with the main window. I’m trying to put a selected value to my dropdownlist but it fails in IE. If I put alert() before my code , it’s executed but not without it ( this only in IE 6 and 7. in FF it’s working like it should be. ). I’ve checked if the page is loaded completely before calling my javascript. The onLoad didn’t work so I placed php-variables in top and bottom of the code and set it to false in the beginning and true in the end. It gave true but still didn’t have any effect.
Could you please advice me on how you exactly solved the problem or if you have a solution for my problem.
Thank’s for advance!