Advertisement
nPhoenix

Falso loop de Ajax.

Jun 10th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. ##############
  3. #   BY PHX   #
  4. ##############
  5. */
  6. d = document;
  7.  
  8. function loop(page, element_id, speed) {
  9.     FRM = "FRM_" + new Date().getTime();
  10.     ajax = d.createElement("iframe");
  11.     ajax.src = page;
  12.     ajax.id = FRM;
  13.     ajax.style.display = "none";
  14.     d.head.appendChild(ajax);
  15.     ajax.onload = function () {
  16.         d.getElementById(element_id).innerHTML = (d.getElementById(FRM).contentWindow.document.body.innerHTML);
  17.         setTimeout("loop(page, element_id, speed)", speed * 1000);
  18.     };
  19. };
  20. loop('/tal_pag.php', 'id_do_elemento', 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement