[Javascript] Sleep, or something else...

João Cândido de Souza Neto joao at curitibaonline.com.br
Fri Aug 18 15:01:14 CDT 2006


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 
  To: '[JavaScript 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/20060818/75303385/attachment.htm>


More information about the Javascript mailing list