test if content has been loaded

M

Mokka

I need to test if content in my div inserted via innerhtml is done
loading.

how is this done? i need it because i want to show a "loading...." text
until all the content has be loaded.
 
E

Evertjan.

Mokka wrote on 16 mrt 2006 in comp.lang.javascript:
I need to test if content in my div inserted via innerhtml is done
loading.

Need? [You would like, I suppose]
how is this done? i need it because i want to show a "loading...." text
until all the content has be loaded.

Show us your relevant code.

What do you mean by loading in the context of innerHTML?
 
C

Crazy Code Ninja

You can always use a global variable and use setInterval to check if
the variable has changed status. I assume here that you are using
asynchronous javascript call (AJAX).

Example:

<script>
var g_writing_done = false;

// check every 2 seconds
var g_interv_1 = setInterval(check_writing, 2000);

function check_writing()
{
if( g_writing_done )
{
// innerHTML writing is completed
...

// clear the interval to stop it executing
clearInterval(g_interv_1);
}
}
</script>

There is no built in way that I know of. But then as someone here has
pointed out, show us more code.
 
T

Thomas 'PointedEars' Lahn

Crazy said:
You can always use a global variable and use setInterval to check if
the variable has changed status. I assume here that you are using
asynchronous javascript call (AJAX).

If an asynchronous XML HTTP request would be used, there was no need for
window.setInterval().
Example:

<script>

The `type' attribute is required:

var g_writing_done = false;

// check every 2 seconds
var g_interv_1 = setInterval(check_writing, 2000);

This will break in IE < 5.0.

setInterval() is a method of Window objects and should be referred
to as such. A previous feature test on runtime is obligatory.

Will you stop posting advice until you have a minimum clue?


PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 3/17/2006 9:53 PM:
If an asynchronous XML HTTP request would be used, there was no need for
window.setInterval().

And if something more reliable is used then an XMLHTTPRequest object is
not needed.
The `type' attribute is required:

<script type="text/javascript">

And totally 100% irrelevant.
This will break in IE < 5.0.

Who in there right mind gives a crap about IE4? Well, other than JRS.
setInterval() is a method of Window objects and should be referred
to as such. A previous feature test on runtime is obligatory.

Nonsense. Name a browser that doesn't support setInterval.
Will you stop posting advice until you have a minimum clue?

Practice what you preach.
 
C

Crazy Code Ninja

Will you stop posting advice until you have a minimum clue?

Are you retarted or something? stop stalking my post you freak!
 
R

Randy Webb

Crazy Code Ninja said the following on 3/19/2006 4:56 PM:
Are you retarted or something? stop stalking my post you freak!

Welcome to c.l.j and glad you got to meet Thomas.....
 
C

Crazy Code Ninja

I'd be more than happy if anyone show me the error of my way by giving
me some useful information/explanation. Just stop stalking my post to
say retarded stupid thing like:
 
C

Crazy Code Ninja

Thomas said:

I said useful information, not some mumbo jumbo irrelevant stupid
argument crap that in the end turned out to be wrong as pointed out by
another person in this thread. Ironic really, after all that big talk
of yours.

No, you go away, this is newsgroup, if you don't like my post, you can
leave and stay in your kitchen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top