473,585 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to force reload of "temperature.js " data

Hello,

Say I have a server that's saving the CPU temperature to
'temperature.js ' once a second. The contents of the file is one single
line:

var temperature = "35.5";

And it changes as the temperature changes.

Is it possible to have an HTML file in the same directory as the
"temperature.js " file, that's reading the file once a second and then
provides a crude realtime update of the temperature value?

The HTML result would look something like:

TEMPERATURE:
35.5
35.6
35.4
35.7
36.1
....etc, page continues appending temperature by the second...

I know how to used .innerHTML to append values to a list, but I'm having
trouble getting my "temperature.js " script to reload and execute once a
second, so that the "temperatur e" variable is always up-to-date. It
seems that the temperature is reloaded only when the whole HTML page is
loaded.

Any assistance would be appreciated,
Thanks,
Derek.

Jul 20 '05 #1
5 7818
In article <I_************ *********@news1 .calgary.shaw.c a>,
Derek Ross <dr***@iders.ca > wrote:

I know how to used .innerHTML to append values to a list, but I'm having
trouble getting my "temperature.js " script to reload and execute once a
second, so that the "temperatur e" variable is always up-to-date. It
seems that the temperature is reloaded only when the whole HTML page is
loaded.


Try

<script ... id="data" src="temperatur es.js"></script>

To reload

document.getEle mentById("data" ).src = "temperatures.j s"

To do this periodically, use setTimeOut()
Jul 20 '05 #2
In article <ri************ *************** *@news.so-net.com.hk>,
Chris Riesbeck <ri******@cs.no rthwestern.edu> wrote:
Try

<script ... id="data" src="temperatur es.js"></script>

To reload

document.getEle mentById("data" ).src = "temperatures.j s"


Tested a bit more -- this only seems to work in IE,
not Mozilla or Opera

So follow the usual hack and a frameset with an invisible
frame with an HTML file that loads the javascript, and
then reload that frame as needed.
Jul 20 '05 #3
I would create a page with two frames. A main frame and a hidden
frame. The hidden frame would have an onload event handler that
appends the temperature to the document displayed in the main frame.
It would then pause for an arbitrary period, and reload itself.

Bernie

Derek Ross <dr***@iders.ca > wrote in message news:<I_******* **************@ news1.calgary.s haw.ca>...
Hello,

Say I have a server that's saving the CPU temperature to
'temperature.js ' once a second. The contents of the file is one single
line:

var temperature = "35.5";

And it changes as the temperature changes.

Is it possible to have an HTML file in the same directory as the
"temperature.js " file, that's reading the file once a second and then
provides a crude realtime update of the temperature value?

The HTML result would look something like:

TEMPERATURE:
35.5
35.6
35.4
35.7
36.1
...etc, page continues appending temperature by the second...

I know how to used .innerHTML to append values to a list, but I'm having
trouble getting my "temperature.js " script to reload and execute once a
second, so that the "temperatur e" variable is always up-to-date. It
seems that the temperature is reloaded only when the whole HTML page is
loaded.

Any assistance would be appreciated,
Thanks,
Derek.

Jul 20 '05 #4
One approach was covered in this newsgroup 2 days ago under the title:
How to hit a server in the background
If you can't find it, do a search on google - it's already there.

In your case, since you're only returning a single datum, I'd
be highly inclined to test out whether cookies load with .js files
Please do report back if you go this route.

Good Luck,
Csaba Gabor from New York
"Derek Ross" <dr***@iders.ca > wrote in message news:I_******** *************@n ews1.calgary.sh aw.ca...
Hello,

Say I have a server that's saving the CPU temperature to
'temperature.js ' once a second. The contents of the file is one single
line:

var temperature = "35.5";

And it changes as the temperature changes.

Is it possible to have an HTML file in the same directory as the
"temperature.js " file, that's reading the file once a second and then
provides a crude realtime update of the temperature value?

The HTML result would look something like:

TEMPERATURE:
35.5
35.6
35.4
35.7
36.1
...etc, page continues appending temperature by the second...

I know how to used .innerHTML to append values to a list, but I'm having
trouble getting my "temperature.js " script to reload and execute once a
second, so that the "temperatur e" variable is always up-to-date. It
seems that the temperature is reloaded only when the whole HTML page is
loaded.

Any assistance would be appreciated,
Thanks,
Derek.


Jul 20 '05 #5
Thank you for the advice.

FWIW, I've also had some success with calling the js script in a
popunder window, but I think I'll go with the frameset idea. Many
people disable popups, which would pose a problem for me.

Derek.

Jul 20 '05 #6

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

Similar topics

5
4899
by: Eric | last post by:
Is it possible? I'm trying to add to the current page -- but add at a specific point. Can add HTML tags from javascript midway through the page (at a place I specify) without erasing the existing page? Thanks, Eric
5
3449
by: Charles Crume | last post by:
Hello all; I've been able to locate, and download, the source for "animate.js" from a number of web sites, but have not been able to find *any* documentation on this script. Does anyone have any docs, or point to where they are? (I've tried about a dozen different search term combinations on google -- but no joy!!) TIA
4
6434
by: Dmitry | last post by:
Hello, Sometimes on js code execution Mozilla 1.5 prints in JS concole the following error: "Error: fn is not defined" where "fn" is the function name surely defined _before_ the line that produces error. The fn body and error line both live in the same *.js file.
10
3389
by: Blue® | last post by:
I would like to call the content of content.htm (containing only HTML codes) into index.htm. This is usually done by renaming index.htm to index.shtml and use this tag: <!--#include file="content.htm" --> But I do not want to use SSI. Is it possible to call it using something like:
7
3282
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with "registerClientScriptBlock" as follows: string script = "<script language=jscript>"; script += "function test()";
2
6741
by: eschl | last post by:
Doesn't "prototype.js" support the "responseXML" property of the XMLHttpRequest object? var url = "test.jsp"; var pars = ""; var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: mycallback } );
1
5995
by: santhoskumara | last post by:
suppose i have two javascript file, where my jsp page need both the .js file. how will i import to my page. whether i need to put a two script tag and mention the path value in the src attribute like this ex: <script src="/*.js"></script> <script src="/*.js"></script> while i...
9
2912
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using JavaScript. I have used a readymade javascript and there are variables like...
3
7817
by: joe | last post by:
Is it OK to have multiple: <script type="text/javascript" src="funcs1.js"></script> <script type="text/javascript" src="funcs2.js"></script> <script type="text/javascript" src="funcs3.js"></script> ? And I need to use similarly multiple CSS:
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8336
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6606
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.