View Full Version : document.body.styl1.cursor Not working as expected

01-18-2005, 09:59 PM
I have a function that reads a table and writes a .csv file. Since some of the tables being read are sizeable, a minute or so can pass before the write is complete and the file is opened in Excel. I want to change the cursor so that it equals "wait" why the operation is running. Per the following code, the cursor changes AFTER the write is complete. Why? How can I change this behavior?

function WriteToFile(tableID) {
try {
var fso, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
s = fso.OpenTextFile("C:\ice_temp.csv",2,1,-2);
s.writeline("ICE_grpmth Report - Function Code Groups by Month - Hours");
s.writeline("For Program(s): THAAD (Terminal High Altitude Area Defense)");
s.writeline("Report Date: January 18 2005 14:35");
var i;
var j;
var fileline = "";
var mycell;
for (i=0; i < document.getElementById(tableID).rows.length; i++) {
for (j=0; j < document.getElementById(tableID).rows(i).cells.length; j++){
mycell = document.getElementById(tableID).rows(i).cells(j)
fileline = fileline + "\"" + mycell.innerText + "\",";
fileline = "";
var myshell = new ActiveXObject("WScript.shell");

01-18-2005, 10:27 PM
You will have to put a function in to change the cursor, then call the function that will do the processing in a setTimout. Otherwise, the cursor changes at the start of the code, executes the rest of the code and chages the cursor back, never reflecting the changed cursor to the user.


01-19-2005, 02:25 AM
Basscyst is correct. You can also try this without creating another function.

function WriteToFile(tableID) {
setTimeout("document.body.style.cursor='wait'", 1);
try {