SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to keep this firing

    Hello, here's a working http request. If you upload it named as anything.html along with a page named test.html, it will call whatever text you put in test.php It will put the text in the div id named T1.
    <html>
    <head>
    <script type="text/javascript">
    function myNewXMLobject(){
    var xmlhttp=false;
    try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
    xmlhttp = false;
    }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    try {
    xmlhttp = new XMLHttpRequest();
    } catch (e) {
    xmlhttp=false;
    }
    }
    if (!xmlhttp && window.createRequest) {
    try {
    xmlhttp = window.createRequest();
    } catch (e) {
    xmlhttp=false;
    }
    }
    return xmlhttp;
    }
    xmlobject=myNewXMLobject();
    function up()
    {xmlobject.open("GET", "test.php",true);
    xmlobject.onreadystatechange=function() {
    if (xmlobject.readyState==4) {
    document.getElementById('T1').innerHTML=xmlobject.responseText;
    alert(xmlobject.responseText)
    }
    }
    xmlobject.send(null)
    }
    </script>
    </head>
    <body onload="up();">
    <div id="T1" style="border:1px solid black;height:100;width:150"></div>
    </body>
    </html>
    I need to know how to keep the request firing. So that after it pulls the page it will pull it again after so much time. I tried setInterval(' ',10000); but I didn't know where to put it and which function to use for it. I also didn't know if the body onload was keeping it from firing again. Please get back to me, I can really use some help on finishing this, thank you very much.
    Last edited by 1Jen; Apr 24, 2007 at 01:54.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •