Fúlvio wrote on 21 feb 2008 in comp.lang.javascript:
[Pleasedo not toppost on usenet]
Sorry by my delay to answer. I have some problems.
The code that I am trying to work is this:
<script type="text/javascript" language="javascript">
Leave the language="javascript" out, not necessary in this century
function makeRequest() {
conteudo.style.display = 'block';
This will only work in IE, methinks, use:
document.getElementById('conteudo')
// do something timeconsuming
The effect in most if not all browsers
will only be shown if the JS ends the execution of the function,
so the effect of the ="block" and ="none" wil be nearly symultaneously.
conteudo.style.display = 'none';
}
</script>
<div id="conteudo" style="display: none;">PleaseWaiting</div>
"PleaseWaiting" is not English, "Police Waiting" could be.
Use "Pleasewait".
Try this:
=================================
<script type='text/javascript'>
function makeRequest() {
document.getElementById('conteudo').style.display = 'block';
setTimeout('makeRequest2()',10);
};
function makeRequest2() {
// do something timeconsuming here
document.getElementById('conteudo').style.display = 'none';
};
</script>
<div id='conteudo' style='display: none;'>PleaseWait...</div>
=================================
the delay will set CSS display to block,
before starting the time consuming process.
The ending of the makeRequest2() will set display to none.
Not tested.