Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > read variable from file

Reply
Thread Tools

read variable from file

 
 
ark312
Guest
Posts: n/a
 
      06-17-2005
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




 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      06-17-2005
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)

 
Reply With Quote
 
 
 
 
ark312
Guest
Posts: n/a
 
      06-17-2005

"Evertjan." <(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File.read(fname) vs. File.read(fname,File.size(fname)) Alex Dowad Ruby 4 05-01-2010 08:20 AM
file.read() doesn't read the whole file Sreejith K Python 24 03-24-2009 12:20 PM
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
Database file and folder are not read only but error message says it is read only?? keithb ASP .Net 2 06-07-2006 03:40 PM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM



Advertisments