473,324 Members | 2,473 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,324 software developers and data experts.

Read a file from disk

Dear all,

I'm a newbie of JS. I'm starting to write a web application that has
some fields where I want to put
an help icon. When the user click on the icon, appears a new little
browser with the help inside.

I have the following code:

var header = "<html><head><link REL='stylesheet' TYPE='text/css'
href='/css/help.css'></head><body><fieldset><legend>Help</legend>";
var footer = '</fieldset><center><input type=button class="button"
value="Click to close when finished"
onClick=window.close()></center></body></html>';

var cyana_protein_name = "Enter the protein name without spaces
inside";

function helpme(name) {
if (name=='cyana_protein_name') {
msg=cyana_protein_name;
}

newwin =
window.open('','','top=150,left=150,width=325,heig ht=200');
if (!newwin.opener) newwin.opener = self;
with (newwin.document)
{
open();
write(header);
write(msg + '<br>');
write(footer);
close();
}
}

So, for some help works well, but I'll have a lot of help to display.
Is it possible to read from the server disk a text file based on the
name passed to the helpme function
and display the file content?

Thanks Enrico

Nov 20 '06 #1
3 3339
morellik said the following on 11/20/2006 9:08 AM:
Dear all,

I'm a newbie of JS. I'm starting to write a web application that has
some fields where I want to put
an help icon. When the user click on the icon, appears a new little
browser with the help inside.

I have the following code:

var header = "<html><head><link REL='stylesheet' TYPE='text/css'
href='/css/help.css'></head><body><fieldset><legend>Help</legend>";
var footer = '</fieldset><center><input type=button class="button"
value="Click to close when finished"
onClick=window.close()></center></body></html>';

var cyana_protein_name = "Enter the protein name without spaces
inside";

function helpme(name) {
if (name=='cyana_protein_name') {
msg=cyana_protein_name;
}

newwin =
window.open('','','top=150,left=150,width=325,heig ht=200');
if (!newwin.opener) newwin.opener = self;
with (newwin.document)
{
open();
write(header);
write(msg + '<br>');
write(footer);
close();
}
}

So, for some help works well, but I'll have a lot of help to display.
Is it possible to read from the server disk a text file based on the
name passed to the helpme function
and display the file content?
Make your help files .js files and then you can read them - easily -
from the server. It also makes it easier to handle the text as JS data
than if it is plain text.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 21 '06 #2
In comp.lang.javascript message
<11**********************@h48g2000cwc.googlegroups .com>, Mon, 20 Nov
2006 06:08:36, morellik <en************@gmail.comwrote:
>
So, for some help works well, but I'll have a lot of help to display.
Is it possible to read from the server disk a text file based on the
name passed to the helpme function
and display the file content?
For me, testing locally in js-quick.htm, the code

XX = window.open("js-alarm.htm", "fred")
XX.document.getElementById("Until").innerHTML = "Friday"

opens js-alarm.htm and sets element Until to read Friday.

That should get you started; you can for example load a fairly general
help file instead of js-alarm.htm and customise it with something
instead of Friday.

It's a good idea to read the newsgroup and its old FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
<URL:http://www.jibbering.com/faq/ Old RC FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 21 '06 #3

Thanks to all,

I'll read the documentation and start to test yours suggestions.

Enrico

Nov 22 '06 #4

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

Similar topics

5
by: Jim | last post by:
Hi, I am trying to figure out a way to implement a timeout along with a read() call on an open file. It only has to work on linux, for now I am trying: ret = select.select( ,,, timeout ) if...
11
by: Sebastian Krause | last post by:
Hello, I tried to read in some large ascii files (200MB-2GB) in Python using scipy.io.read_array, but it did not work as I expected. The whole idea was to find a fast Python routine to read in...
4
by: Cloud Burst | last post by:
I'm writing a javascript for my own use. I'd like it to read my disk to get some information. In particular, I want to find out how much disk is being used by some directories. At present, I'm...
9
by: Kelvin | last post by:
Hi, group: I am intermediate in C programming, basically I programmed in Unix for digital signal processing... Now I need to write a C++ program to read/write the whole volume of a FAT...
2
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
1
by: Shrirang Ballal | last post by:
I am doing a project which requires to read the raw bytes from hard disk. It rrequires to access the partition table and then the individual partitions. I want some material related to these...
5
by: Sumana | last post by:
Hi All, We developed our project on VC++.Net console application to create image of disk and to write the image We are having problem with reading and writing the sector beyond 6GB Disk or...
8
by: dosworldguy | last post by:
I have been having a very peculiar issue from a long time. I have an application where multiple clients read from a shared set of files. When a record is changed, sometimes the win9x clients...
70
by: quickcur | last post by:
hi can anyone explain me to read image to memory from a url it is very easy in java but it is hard to find an complete solution in c/c++. Thanks,
1
by: Steven D'Aprano | last post by:
On Wed, 22 Oct 2008 16:59:45 -0400, Terry Reedy wrote: With respect Terry, I think what you have missed is the reason why the OP thinks this is a bug. He's not surprised that buffering is going...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.