[Javascript] Sleep, or something else...

Peter Lauri lists at dwsasia.com
Fri Aug 18 15:27:49 CDT 2006


This did help, but I changed it to, thanks.

 

function msgAddTo(toid, toname) {

      if(!document.getElementById('msgsubject')) showCompose();

      

      setTimeout("msgAddToFields("+toid+", '"+toname+"');", 100);

 

      msgCheckSendForm();

}

 

function msgAddToFields(toid, toname) {

      document.getElementById('msgto').value =
document.getElementById('msgto').value + toid + "; ";

      document.getElementById('msgtoname').innerHTML =
document.getElementById('msgtoname').innerHTML + toname + "; ";

}

 

/Peter

 

 

  _____  

From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu]
On Behalf Of João Cândido de Souza Neto
Sent: Saturday, August 19, 2006 3:01 AM
To: [JavaScript List]
Subject: Re: [Javascript] Sleep, or something else...

 

Try to do this:

 

if(!document.getElementById('msgsubject')) showCompose();

setTimeout("

document.getElementById('msgto').value =
document.getElementById('msgto').value + toid + ";";

document.getElementById('msgtoname').innerHTML =
document.getElementById('msgtoname').innerHTML + toname + "; ";

",500);

 

It would make a sllep until the objects has been created.

 

If needed, you ought to increase the time of setTimeout.

 

Hope help.

João Cândido de Souza Neto
Curitiba Online
joao at curitibaonline.com.br
(41) 3324-2294 (41) 9985-6894
http://www.curitibaonline.com.br

 

----- Original Message ----- 

From: Peter Lauri <mailto:lists at dwsasia.com>  

To: '[JavaScript <mailto:javascript at LaTech.edu>  List]' 

Sent: Friday, August 18, 2006 4:49 PM

Subject: [Javascript] Sleep, or something else...

 

I have this:

 

if(!document.getElementById('msgsubject')) showCompose();

 

document.getElementById('msgto').value =
document.getElementById('msgto').value + toid + ";";

document.getElementById('msgtoname').innerHTML =
document.getElementById('msgtoname').innerHTML + toname + "; ";

 

 

 

The showCompose() creates element with id msgto and msgtoname. However, it
is not recorded. However, if I put an alert() in between it detects it. This
makes me believe that it is actually going a little bit too fast for my
script, so that the msgto and msgtoname does not have time to be created, so
they can not be found (error in script). The alert() seam to give the script
enough time for the elements to be created, and it works, hrm :)

 

Anyone with insights?

 

/Peter

 

 

 

 


  _____  


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060819/bfefccea/attachment.htm>


More information about the Javascript mailing list