473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Change Cursor Style before and after AJAX Request

Hi all, this is my first time posting so any help is appreciated! I
am doing a simple AJAX request to our server, and I would like the
cursor style changed to 'wait' when the user clicks a button which
calls the function below. After the request is complete, I would like
the style changed back. For some reason, it doesn't change the cursor
style until after the request is made, even though it's the first line
I put in the function. I tried putting it in a seperate function and
calling that in this function and in the onclick even handler, I tried
taking out the AJAX request and it works fine, etc. I know it does it
after the request because when I comment out the line setting it back
to 'auto' so it will change to 'wait' the entire time, it doesn't do
so until after the request is completed. I researched and did not find
any other users experiencing the same problem, but hopefully someone
can shed some light on the situation. Here is the function after I
deleted out the irrelevent parts. Thanks in advance!
function qaResults(){
document.body.style.cursor='wait';

***code here to find dbname and query1****

var d = new Date();
recReq = new ActiveXObject("Microsoft.XMLHTTP");

recReq.open("get", "ProduceTable.aspx?choice=queryResults&query=" +
query1 + "&dbname=" + dbname + "&timer=" + d.getTime(), false);

recReq.send();
if (recReq.readyState == 4)
{
if (recReq.status == 200)
{

document.getElementById('ResultsTable').innerHTML =
recReq.responseText;
document.getElementById('ResultsTable').style.heig ht = "200px";
sortables_init();
}
else
alert("There was a problem retrieving HTML table:\n" +
recReq.statusText);
}
document.body.style.cursor = 'auto';

}

Apr 3 '07 #1
1 2966
because you use the sync send, the browser cannot display the cursor as
no window loops are performed (you have stalled the ie main thread). you
can switch to async or change the cursor, and use window.setTimeout to
start the request.

-- bruce (sqlwork.com)
ni**********@gmail.com wrote:
Hi all, this is my first time posting so any help is appreciated! I
am doing a simple AJAX request to our server, and I would like the
cursor style changed to 'wait' when the user clicks a button which
calls the function below. After the request is complete, I would like
the style changed back. For some reason, it doesn't change the cursor
style until after the request is made, even though it's the first line
I put in the function. I tried putting it in a seperate function and
calling that in this function and in the onclick even handler, I tried
taking out the AJAX request and it works fine, etc. I know it does it
after the request because when I comment out the line setting it back
to 'auto' so it will change to 'wait' the entire time, it doesn't do
so until after the request is completed. I researched and did not find
any other users experiencing the same problem, but hopefully someone
can shed some light on the situation. Here is the function after I
deleted out the irrelevent parts. Thanks in advance!
function qaResults(){
document.body.style.cursor='wait';

***code here to find dbname and query1****

var d = new Date();
recReq = new ActiveXObject("Microsoft.XMLHTTP");

recReq.open("get", "ProduceTable.aspx?choice=queryResults&query=" +
query1 + "&dbname=" + dbname + "&timer=" + d.getTime(), false);

recReq.send();
if (recReq.readyState == 4)
{
if (recReq.status == 200)
{

document.getElementById('ResultsTable').innerHTML =
recReq.responseText;
document.getElementById('ResultsTable').style.heig ht = "200px";
sortables_init();
}
else
alert("There was a problem retrieving HTML table:\n" +
recReq.statusText);
}
document.body.style.cursor = 'auto';

}
Apr 3 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
6
by: Stefan Mueller | last post by:
With document.body.style.cursor = "wait"; I can set the hourglass and with document.body.style.cursor = "default"; I can set the MousePointer back. That works great. But if I do...
1
by: arash | last post by:
Hi! I am trying to write some ajax based IDE. I just cant get a div to open where the cursor in the textarea is blinking (in order to suggest possibilities..) Is there a way to get the exact...
1
by: chamitha | last post by:
I have a script which sets the mouse cursor using <object>.style.cursor = "wait,progress" This causes a strange behaviour where a HTTP request is sent to the server for virtualdir\wait. For...
0
by: =?Utf-8?B?SmltSGVhdmV5?= | last post by:
I created my first AJAX web page, I put a few controls on a form and then invoked the debugger. When it comes up, there is not blinking cursor. If I use my mouse to activate a control, such as a...
18
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of...
6
by: vinniemac | last post by:
Using javascript, how can I change an attribute for ALL anchors (A:hover) on the webpage?
1
by: bibhukdas | last post by:
Hi All, Just to elaborate on the issue. The requirement is to handle this in javascript 1. User clicks on a button 2. Change the cursor style (We are using document.body.style.cursor="wait") 3....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.