JavaScript
--
Questions
--
Followers
Top Experts
document.body.style.cursor
importTextFile();
function importTextFile()
{
var fileString;
var ctlStat = document.getElementById("s
ctlStat.innerHTML = "scanning file ...";
var cFilename = document.getElementById("c
cFilename = cFilename.replace(/^\s+|\s
var fso = new ActiveXObject("Scripting.F
var file = fso.OpenTextFile(cFilename
var nNumLines = 0;
if (fso.FileExists(cFilename)
{
fileString = "";
var strNextLine = "";
while (!file.AtEndOfStream)
{
strNextLine = file.ReadLine()
if (strNextLine.length > 0)
{
if (strNextLine.indexOf("&") >= 0)
{
strNextLine = strNextLine.replace(/&/g, '-');
}
strNextLine = strNextLine + "\r\n";
}
if (strNextLine.length > 0)
{
fileString = fileString + strNextLine;
nNumLines ++
aFile.push(strNextLine);
}
}
file.close();
}
ctlStat.innerHTML = "Done.";
document.body.style.cursor
}
The cursor does not change, and also my status element is not updated with the assigned text ("scanning file"), while the file is being read.
I tried
setTimeout("document.body.
but it did not work.
Also tried
setTimeout("importTextFile
but for some reason the file then was not processed?!
Thank you very much for any ideas.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
document.body.style.cursor
setTimeout("importTextFile
SHOULD work with bot changing the cursor and calling the function
Are you sure you cleared your cache before trying the above?
http://ajaxpatterns.org/Progress_Indicator
Since FSO does not offer an asynchronous load, there is really no way around the problem, unless you write your own ActiveX control which does an asynchronous load.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
If you change the cursor you change the cursor.
If you then 100 milliseconds AFTER changing the cursor you start the download, the cursor STAYS changed until something changes it back or unless the browser does not ALLOW you to change the cursor

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
bethKoala: I have been doing a bit of research and here's a link which confirms my suspicions and suggests a solution :-
http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/257990100bd2383f
I know he did, and it SHOULD work, so I wanted to make sure it was not due to something else.
Please show me the part in what you posted that is different to what he already tested and that I re-suggested and the solution?
here is a version that works in IE7 on XP
<html>
<head>
<script>
var theLink = null;
function tryOne(link) {
document.body.style.cursor = "wait";
theLink = link;
theLink.style.cursor = "wait";
setTimeout("importTextFile()",100);
}
function importTextFile() {
for (var i=0;i<10000000;i++) ;
document.body.style.cursor = "auto";
if (theLink) theLink.style.cursor = "auto";
}
</script>
</head>
<body>
<a href="#" onClick="tryOne(this); return false">change and setTimout</a>
</body>
</html>






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
document.body.style.cursor
setTimeout("checkCursor()"
importTextFile();
document.body.style.cursor
function checkCursor()
{
if (document.body.style.curso
{
clearTimeout();
}
else
{
setTimeout("checkCursor()"
}
}
What happens now is that if I move the cursor off the window itself, it changes to a horizontal double-arrow. Then at the very end it shows as an hourglass, briefly.
<< Are you sure you cleared your cache before trying the above? >>
Please tell me what the code would be for this?
Any further help is greatly appreciated.
2. What is this supposed to do???
function checkCursor()
{
if (document.body.style.curso
{
clearTimeout();
}
else
{
setTimeout("checkCursor()"
}
}
I see no reason for this script.
Did you try mine? Worked in IE7 as expected

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
setTimeout("doIimport()",3
function doImport()
{
importTextFile();
document.body.style.cursor
}
But this is weird. If I use the timeout on the first function that I call, then succeeding functions which depend on the results of the first, are not called.
setTimeout(importTextFile(
alert("got here 1"); does not show
extractFromFile(); not called ...
getProcs(); not called ...
doCompare(); not called ...
alert("got here 2"); does not show
saveReport(); not called
If I do not use the timeout, then everything is OK. I have tried many things, such as bunching the functions into another and calling that one with a timeOut, calling a timeOut before each function, etc., all results are bad. Do you know what I am doing wrong?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
You MUST use setTimeout('importTextFile
to execute the function in 100 ms
My functions are now being executed in a different order? I put in an alert at the end of importTextFile() and it shows after the saveReport()! I don't think it is just a display timing issue, because the report is empty, as the lines from the text file are not being read until it is too late. Without the setTImeout, it is OK.
Maybe my users will just have to trust me that things are in progress! Why is this so hard? Thanks for your patience.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
JavaScript
--
Questions
--
Followers
Top Experts
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.