Shoutbox

Website Script Help For Personal Message - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Website Script Help For Personal Message (/showthread.php?tid=78951)

Website Script Help For Personal Message by Sharkadder on 11-11-2007 at 04:26 PM

Hi, i am quite new to javascript and xml but i think i can understand most of the coding which goes on.

Anyways, i have a script which i created...well i say created, i tried copying a firefox script i have and what i want wont work. Heres the problem:

I'm wanting the script to display items from an xml file which is on my web server within my personal name on msn, the firefox example i have does that but it wont work when i try including it within my script.

Currently it just displays my website name "www.sharkadder.com" and not the rest of the xml file content, i know where i've gone wrong but its the actual javascript code to display the xml file conents which i need.

the xml file is all complete, its the coding with the JS i'm abit stuck on and the javascript code is:

code:
function OnEvent_Initialize( MessengerStart )
{

    // Is the user connected?   
    if ( Messenger.MyStatus >= 3 )
    {

        // We call the counter updating function
        UpdateSharkadderCounter();           

        // We set up a timer to update the download counter, in 5 minutes
        MsgPlus.AddTimer( "Sharkadder", 300000 );

    }

}

function OnEvent_Uninitialize( MessengerExit )
{

    // If the script is unitialized, the timer is cancelled
    MsgPlus.CancelTimer( "Sharkadder" );
   
}

function OnEvent_Signout( Email )
{

    // If the user signs out, the timer is cancelled
    MsgPlus.CancelTimer( "Sharkadder" );
   
}

function OnEvent_SigninReady( Email )
{

    // We call the counter updating function
    UpdateSharkadderCounter();
   
    // We set up a timer to update the download counter, in 2 minutes
    MsgPlus.AddTimer( "FirefoxTimer", 300000 );

}

function UpdateSharkadderCounter()
{

    // We create the ActiveX Objects
    var http = new ActiveXObject( "Microsoft.XMLHTTP" );
    var xml = new ActiveXObject( "Microsoft.XMLDOM" );

    // We assign an anonymous function to the XMLHttpRequest event
    // This function will be called several times during the HTTP transaction
    http.onreadystatechange = function()
    {
       
        // Is the state equal to 4? Is the status equal to 200?
        if ( ( http.readyState == 4 ) && ( http.status == 200) )     
        {
       
            // We get the feed, from the HTTP Response
            var feed = http.responseText;
           
            // We load it into the XMLDOM
            xml.loadXML( feed );
           
            // We get the counter value
            var count = xml.getElementsByTagName( "description" )[1];
           
            // We set the personal message to the download count
            Messenger.MyPersonalMessage = "www.sharkadder.com ";
           
        }
       
    }
   
    // We open the feed URL ( Date on the request URL to avoid caching )
    http.open( "POST", "http://www.sharkadder.com/sharkadderrss.xml" + Date(), false );
   
    // We set the request header
    http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );

    // And send the HTTPRequest
    http.send( "" );

}

function OnEvent_Timer( TimerId )
{
    Debug.Trace ( TimerId );

    // Is it the timer we want?
    if ( TimerId == "Sharkadder" )
    {

        // We call the counter updating function
        UpdateSharkadderCounter();
       
        // We add the timer again
        MsgPlus.AddTimer( "Sharkadder", 300000 );
       
    }
   
}






Thats the code, basically what im trying to do is display the contents from the xml file every so often when the timer resets, how do i modify my code to do that?

also i'd like to know for future do you know any example where i can display how many people have visited my website "www.sharkadder.com"? thanks.

Sorry if i've asked a duplicated question, i did search the forum and never found what i was looking for, i went through the documentation and it wasn't at all what i was wanting.

hope you can help me abit