read variable from file

Discussion in 'Javascript' started by ark312, Jun 17, 2005.

  1. ark312

    ark312 Guest

    Hello,

    I'm using a java-script in a HTML-page. Part of the script is the line:

    var limit = 1136 - 1101;

    The value 1136 is a counter and changes permanantly. In VB I can write a
    routine which prints the actual value to a fule called COUNTER.TXT.

    Can I change my JavaScript in such a way that it reads the value of the file
    COUNTER.TXT?


    Thanks,

    Sjoerd
    ark312, Jun 17, 2005
    #1
    1. Advertising

  2. ark312

    Evertjan. Guest

    ark312 wrote on 17 jun 2005 in comp.lang.javascript:

    > I'm using a java-script in a HTML-page. Part of the script is the
    > line:
    >
    > var limit = 1136 - 1101;
    >
    > The value 1136 is a counter and changes permanantly. In VB I can write
    > a routine which prints the actual value to a fule called COUNTER.TXT.
    >
    > Can I change my JavaScript in such a way that it reads the value of
    > the file COUNTER.TXT?
    >


    Dat hangt er van af war die file staat.
    Staat die op je server,
    dan kan je hem [IE only] lezen met:

    function getUrl(url) {
    var http = new ActiveXObject("microsoft.xmlhttp");
    http.open("GET",url,false);
    http.send();
    return http.responseText;
    }


    document.write(getUrl('http://www.mijn.nl/COUNTER.TXT') - 1101)



    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Jun 17, 2005
    #2
    1. Advertising

  3. ark312

    ark312 Guest

    "Evertjan." <> wrote in message
    news:Xns967893EE6578Aeejj99@194.109.133.242...
    > ark312 wrote on 17 jun 2005 in comp.lang.javascript:
    >
    >> I'm using a java-script in a HTML-page. Part of the script is the
    >> line:
    >>
    >> var limit = 1136 - 1101;
    >>
    >> The value 1136 is a counter and changes permanantly. In VB I can write
    >> a routine which prints the actual value to a fule called COUNTER.TXT.
    >>
    >> Can I change my JavaScript in such a way that it reads the value of
    >> the file COUNTER.TXT?
    >>

    >
    > Dat hangt er van af war die file staat.
    > Staat die op je server,
    > dan kan je hem [IE only] lezen met:
    >
    > function getUrl(url) {
    > var http = new ActiveXObject("microsoft.xmlhttp");
    > http.open("GET",url,false);
    > http.send();
    > return http.responseText;
    > }
    >
    >
    > document.write(getUrl('http://www.mijn.nl/COUNTER.TXT') - 1101)
    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >


    Het is lokaal. Bedankt.
    ark312, Jun 17, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. keithb
    Replies:
    2
    Views:
    8,006
    keithb
    Jun 7, 2006
  2. mfglinux
    Replies:
    11
    Views:
    699
    Roberto Bonvallet
    Sep 12, 2007
  3. Sreejith K
    Replies:
    24
    Views:
    1,016
    Sreejith K
    Mar 24, 2009
  4. Alex Dowad
    Replies:
    4
    Views:
    270
    Michel Demazure
    May 1, 2010
  5. David Filmer
    Replies:
    19
    Views:
    240
    Kevin Collins
    May 21, 2004
Loading...

Share This Page