Connecting Tech Pros Worldwide Help | Site Map

Render a DIV while loading

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 16th, 2006, 04:25 PM
matdumsa@gmail.com
Guest
 
Posts: n/a
Default Render a DIV while loading

Hi there!!! I'm wondering what I've did wrong here... I try to do a
gmail-like "loading" red square at top right...

Here is my code:


<div id=loading
style=display:none;background-color:#FF0000;position:absolute;right:0px;top:0px> <b><font
color=white><p
style=text-decoration:blink;>Loading</p></b></font></div>

the javascript i have is like this one:

<script>
document.all("loading").style.display = '';
[some processing that takes CPU]
document.all("loading").style.display = 'none';
</script>

When I run this code, it seems to "freeze" the browser thought not
showing the little loading square as it should while processing... If
there anything like document.all("loading").render ???

Thanks!


  #2  
Old August 16th, 2006, 09:15 PM
web.dev
Guest
 
Posts: n/a
Default Re: Render a DIV while loading


matdumsa@gmail.com wrote:
Quote:
<script>
Type attribute is required, though by default browsers will typically
fallback to javascript.

<script type = "text/javascript">
Quote:
document.all("loading").style.display = '';
[some processing that takes CPU]
document.all("loading").style.display = 'none';
</script>
I would say try to avoid the use of document.all. Introduced in IE4,
you could say it's a propietary property though some browsers do
support it. Using document.getElementById method is more widely
supported.

The main problem with your code statement is that you're trying to
show/hide your "loading" message all in one execution. Break them out
into separate functions and you should be fine. For example:

....
toggleLoading();
[your CPU intensive process]
toggleLoading();
....
Quote:
When I run this code, it seems to "freeze" the browser thought not
showing the little loading square as it should while processing... If
there anything like document.all("loading").render ???
There is no render property.

  #3  
Old August 16th, 2006, 10:55 PM
matdumsa@gmail.com
Guest
 
Posts: n/a
Default Re: Render a DIV while loading

Hi, thanks for answering me,

I've tried the "split toggle loading message" into a function like you
suggest but it produce the same result...

now it's like that

<script type="text/javascript">
toggle_load('');
some cpu thing
toggle_load('none')
</script>

web.dev wrote:
Quote:
matdumsa@gmail.com wrote:
Quote:
<script>
>
Type attribute is required, though by default browsers will typically
fallback to javascript.
>
<script type = "text/javascript">
>
Quote:
document.all("loading").style.display = '';
[some processing that takes CPU]
document.all("loading").style.display = 'none';
</script>
>
I would say try to avoid the use of document.all. Introduced in IE4,
you could say it's a propietary property though some browsers do
support it. Using document.getElementById method is more widely
supported.
>
The main problem with your code statement is that you're trying to
show/hide your "loading" message all in one execution. Break them out
into separate functions and you should be fine. For example:
>
...
toggleLoading();
[your CPU intensive process]
toggleLoading();
...
>
Quote:
When I run this code, it seems to "freeze" the browser thought not
showing the little loading square as it should while processing... If
there anything like document.all("loading").render ???
>
There is no render property.
  #4  
Old August 17th, 2006, 08:05 AM
Arnaud Diederen
Guest
 
Posts: n/a
Default Re: Render a DIV while loading

matdumsa@gmail.com writes:
Quote:
Hi, thanks for answering me,
>
I've tried the "split toggle loading message" into a function like you
suggest but it produce the same result...
>
now it's like that
>
<script type="text/javascript">
toggle_load('');
some cpu thing
toggle_load('none')
</script>
Hi,

What you probably want is:

<script type="text/javascript">
toggle_load ('');
</script>

<script type="text/javascript">
cpu_intensive_thing ();
</script>

<script type="text/javascript">
toggle_load ('none');
</script>


Hope this helps.

A.



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.