Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Site Alert

  1. #11
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Set an interval which makes a AJAX request to the PHP page, output nothing to the PHP page if you don't want anything displayed. Have JavaScript check the response with an if statement, and if it isn't null alert the reponse.
    kinda quit.

  2. #12
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Thats the problem nets.. I have no clue about JS . Never studied it thats why im trying to do this.

    I only know advanced PHP.

  3. #13
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Most people have havent studied any web programming langages? if youve ever used VB, ASP etc its actualy very simlar syntax, although less like Vb and more like php in other ways "/

    it formats alot like php, aka the
    bla{
    somthing;
    somthing;
    }

    but the varibles are refranced more like vb. Useing the Document Object modle

    thisobject.thisproperty.thissubproperty

    (sorry for use of persudo code, im lazy)

    Anyway, heres a nice 30 second ajax tutoral, to give you the low down on that
    http://rajshekhar.net/blog/archives/...-Tutorial.html

    and how to call a function at set intervals use setTimeout

    t=1
    function timedCount()
    {
    t++ ;
    if (t < 5 ) {
    t=setTimeout("timedCount()",4000) ;
    }
    }

    timedCount()

  4. #14
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    var intervalID;

    function show()
    {
    intervalID = setInterval(showHint, 1000);
    }


    var xmlHttp
    function showHint()
    {
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request")
    return
    }
    var url="cfh.php"
    xmlHttp.onreadystatechange=stateChanged
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    }

    function stateChanged()
    {
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
    document.getElementById("txtHint").innerHTML=xmlHt tp.responseText
    }
    }

    function GetXmlHttpObject()
    {
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
    objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
    objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
    }

    I have that to pull the PHP page out. Would that be correct?

  5. #15
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    u need to call the show function in the show hint function, or at least call the interval from that, or it will only check the first time its run, rather than keep checking

  6. #16
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    var xmlHttp
    function showHint()
    {
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request")
    return
    }
    var url="clienthint2.php"
    xmlHttp.onreadystatechange=stateChanged
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)

    var intervalID;

    function show()
    {
    intervalID = setInterval(showHint, 1000);
    }

    }

    function stateChanged()
    {
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
    document.getElementById("txtHint").innerHTML=xmlHt tp.responseText
    }
    }

    function GetXmlHttpObject()
    {
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
    objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
    objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
    }



    This?

Page 2 of 2 FirstFirst 12

Posting Permissions

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