473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

read variable from file

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


Jul 23 '05 #1
2 1567
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)

Jul 23 '05 #2

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@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.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nils Wogatzky | last post by:
Hi, I´ve got a problem with the iftream.read method. I´m reading out a binary file, but I receive wrong values if values are negative. m_File.read((char*)&help2,2); so, help2 is...
6
by: Daniel Loose | last post by:
Hello, I have this strange including problem: I want to read a piece of HTML, residing in some file, into a variable, not echo it out. So far so easy - but now the HTML contains a line of...
5
by: Prabhat | last post by:
Hi All, Is it possible to read any ASP variable from a javascript file (.js) ? Thanks Prabhat
1
by: Magix | last post by:
Hi, I have these string data: str_data1, str_data2, str_data3, which capture some value after a routine process A. Then I would like to write (append) these 3 string values into a text file each...
9
by: ferbar | last post by:
Hi all, I'm trying to read from the txt file 'ip.packets.2.txt' using the read function. It seems everything ok, but I get a -1 when executing >>bytesr = read(fdo1, bufread, 2); The 'open'...
6
by: Samuel M. Smith | last post by:
I have been playing around with a subclass of dict wrt a recipe for setting dict items using attribute syntax. The dict class has some read only attributes that generate an exception if I try to...
3
by: ad | last post by:
I have a text file in the directory of my web application. How can I read this text file into a string vaiable?
3
by: Luke | last post by:
I'm pretty stuck at the moment and wondering if anyone can spot the problem. Trying to create a function that will read a text file into a list and return that list. I wrote the following...
7
by: Tracks | last post by:
I have old legacy code from vb5 where data was written to a file with a variant declaration (this was actually a coding error?)... in vb5 the code was: Dim thisdata as integer Dim thatdata...
2
by: kimmelsd33 | last post by:
I need to read a tab delimited text file in vb6, and store the first column, first line of data in a variable. I need to do the same with the last line, first column of data. This should store a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.