...

View Full Version : Is it possible to force a flush or refresh?



MickeyP
07-10-2005, 03:37 PM
Hi, Am fetching some elements dynamically from server, and since this could take a few moments, wanted to include a "... loading..." message in a span so the user knows to hold on.

Change the visibility of the span class, and then run the function to get the elements. However the javascript runs the code but then goes straight into the database function .. without first affecting the visibility of the span.

Is there some way I can force the script to refresh itself? Some kind of flush etc so can see the change on the page. If I place an alert after the class change, then it works fine, but the moment I take the alert out it seems to run into the database reteival function and forget to make the class change.

document.getElementById('StateLabel').className = 'Show';

FetchStates('MaintainProfile.GetStates', 'stateDisplay', countryId);

document.getElementById('StateLabel').className = 'Hide';

Thanks

Mickey

stymie
07-11-2005, 12:06 AM
Is this what you mean...


document.getElementById('StateLabel').style.visibility = 'visible';

FetchStates('MaintainProfile.GetStates', 'stateDisplay', countryId);

document.getElementById('StateLabel').style.visibility = 'hidden';

glenngv
07-11-2005, 06:48 AM
Try this:


setTimeout(function(){
document.getElementById('StateLabel').className = 'Show';
}, 10);

FetchStates('MaintainProfile.GetStates', 'stateDisplay', countryId);
document.getElementById('StateLabel').className = 'Hide';
You have to delay the showing of the label a bit. If that doesn't work, try delaying the hiding of the label too.

MickeyP
07-11-2005, 11:41 AM
Thank you Glen for your help. Mickey



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum