473,666 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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><l ink REL='stylesheet ' TYPE='text/css'
href='/css/help.css'></head><body><fie ldset><legend>H elp</legend>";
var footer = '</fieldset><cente r><input type=button class="button"
value="Click to close when finished"
onClick=window. close()></center></body></html>';

var cyana_protein_n ame = "Enter the protein name without spaces
inside";

function helpme(name) {
if (name=='cyana_p rotein_name') {
msg=cyana_prote in_name;
}

newwin =
window.open('', '','top=150,lef t=150,width=325 ,height=200');
if (!newwin.opener ) newwin.opener = self;
with (newwin.documen t)
{
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 3362
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><l ink REL='stylesheet ' TYPE='text/css'
href='/css/help.css'></head><body><fie ldset><legend>H elp</legend>";
var footer = '</fieldset><cente r><input type=button class="button"
value="Click to close when finished"
onClick=window. close()></center></body></html>';

var cyana_protein_n ame = "Enter the protein name without spaces
inside";

function helpme(name) {
if (name=='cyana_p rotein_name') {
msg=cyana_prote in_name;
}

newwin =
window.open('', '','top=150,lef t=150,width=325 ,height=200');
if (!newwin.opener ) newwin.opener = self;
with (newwin.documen t)
{
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.javas cript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 21 '06 #2
In comp.lang.javas cript message
<11************ **********@h48g 2000cwc.googleg roups.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.get ElementById("Un til").innerHTM L = "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.c om/faq/ Old RC FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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
16592
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 ret == # do read
11
9020
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 arbitrary ascii files, to replace Yorick (which I use right now and which is really fast, but not as general as Python). The problem with scipy.io.read_array was, that it is really slow, returns errors when trying to process large files and it...
4
1938
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 pasting the output of a command line "du -s" into some text fields and using that information. As I understand it, for security reasons javascript isn't allowed to do disk input/output. Please correct me if I'm wrong.
9
710
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 formatted smartmedia card...I can view the raw data in WinHex...now what I want is, in generic C codes to read all the data I see in WinHex...
2
3224
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
6283
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 issues. If someone can suggest of a book then that is also good. All the books I have seen are related to the GUI design. Waiting for reply, Thank you
5
5098
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 Partition we are using ReadFile , WriteFile and setFilePointerEx to read and write the sectors and we are reading/writing 102400 sectors together, even we have reduced the sectors still it is not able to read or write, our program is working fine...
8
2333
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 still read the old data (if it was read earlier) and this is causing data corruption. WinNT clients inlcuding windows2000 & XP do not have this issue. The program is complied in VC++, console mode. I am unable to understand the cause. I flush the...
70
1059
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
236
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 on: "This indicates some sort of buffering and caching is going on." but he thinks that the buffering should be discarded when you seek:
0
8360
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8876
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8784
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8556
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8642
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.