Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    document.body.styl1.cursor Not working as expected

    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) {
    document.body.style.cursor="wait";
    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 + "\",";
    }
    s.writeline(fileline);
    fileline = "";
    }
    s.Close();
    var myshell = new ActiveXObject("WScript.shell");
    myshell.run("C:\ice_temp.csv");
    }

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    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.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,050
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Basscyst is correct. You can also try this without creating another function.
    Code:
    function WriteToFile(tableID) { 
      setTimeout("document.body.style.cursor='wait'", 1); 
      try {
      ...
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •