473,785 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help with reading from a textfile on webserver

How can I insert preformatted text from a file on the web server
into a table's cell? And then swapped the text in response to an
onClick event.

Something like this.........

<table>
<tr><td>
<img name="swap_grph " src="http://www.mydomain.co m/graphs/piechart1.jpg">
</tr></td><tr><td>
< SOMETAG name="swap_text " src="http://www.mydomain.co m/textfiles/datatable1.txt" >
</tr></td><tr><td>
<form>
<input type="button" value="Next" onclick="swap_d ataset()"/>
</form>
</tr></td>
</table>

<script>
function swap_dataset() {
document.images .swap_grph.src= "http://www.mydomain.co m/graphs/bargraph2.jpg";
document.SOMETH ING.swap_text.s rc="http://www.mydomain.co m/textfiles/datatable2.txt" ;
}
</script>
Thanks.
Jul 23 '05 #1
8 1467
"Rose Chambers" <no@email.com > wrote in message
news:mo******** *************** *********@4ax.c om...
How can I insert preformatted text from a file on the web server
into a table's cell? And then swapped the text in response to an
onClick event.

Something like this.........

<table>
<tr><td>
<img name="swap_grph " src="http://www.mydomain.co m/graphs/piechart1.jpg"> </tr></td><tr><td>
< SOMETAG name="swap_text " src="http://www.mydomain.co m/textfiles/datatable1.txt" > </tr></td><tr><td>
<form>
<input type="button" value="Next" onclick="swap_d ataset()"/>
</form>
</tr></td>
</table>

<script>
function swap_dataset() {
document.images .swap_grph.src= "http://www.mydomain.co m/graphs/bargraph2.jpg"
; document.SOMETH ING.swap_text.s rc="http://www.mydomain.co m/textfiles/datatabl
e2.txt"; }
</script>
Thanks.


Will this help? Watch for word-wrap.

<html>
<head>
<title>swapper. htm</title>
<script type="text/javascript">
var url1 = "http://www.mydomain.co m/graphs/"
var url2 = "http://www.mydomain.co m/textfiles/"
function init_dataset() {
document.images .swap_grph.src = url1 + "piechart1.jpg" ;
document.getEle mentById("swap_ text").innerHTM L = fetch(url2 +
"datatable1.txt ");
}
function swap_dataset() {
document.images .swap_grph.src = url1 + "bargraph2.jpg" ;
document.getEle mentById("swap_ text").innerHTM L = fetch(url2 +
"datatable2.txt ");
}
function fetch(sURL) {
var sTXT = "";
var oXML = new ActiveXObject(" Microsoft.XMLHT TP");
oXML.Open("GET" ,sURL,false);
oXML.send();
try {
sTXT = oXML.ResponseTe xt;
} catch(e) {
sTXT = "[" + e.Description + "]";
}
return sTXT;
}
</script>
</head>
<body onload="init_da taset()">
<table>
<tr>
<td><img name="swap_grph " src=""></td>
</tr>
<tr>
<td><span id="swap_text"> </span></td>
</tr>
<tr>
<td><input type="button" value="Next" onclick="swap_d ataset()" /></td>
</tr>
</table>
</body>
</html>

P.S. Your tags were switched: "</tr></td>".
Jul 23 '05 #2
On Wed, 29 Dec 2004 20:04:24 GMT, "McKirahan" <Ne**@McKirahan .com> wrote:


Will this help?


<snip>

Yes! Thanks so much.

Jul 23 '05 #3
McKirahan wrote:
"Rose Chambers" <no@email.com > wrote in message
news:mo******** *************** *********@4ax.c om...
<--snip-->
Will this help? Watch for word-wrap.
<--snip-->

Did you test it in anything other than IE?
The group FAQ covers this very thing.

function fetch(sURL) {
var sTXT = "";
var oXML = new ActiveXObject(" Microsoft.XMLHT TP");
oXML.Open("GET" ,sURL,false);
oXML.send();
try {
sTXT = oXML.ResponseTe xt;
} catch(e) {
sTXT = "[" + e.Description + "]";
}
return sTXT;
}


--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
On Wed, 29 Dec 2004 17:52:45 -0500, Randy Webb <Hi************ @aol.com> wrote:
McKirahan wrote:
"Rose Chambers" <no@email.com > wrote in message
news:mo******** *************** *********@4ax.c om...
<--snip-->
Will this help? Watch for word-wrap.


<--snip-->

function fetch(sURL) {
var sTXT = "";
var oXML = new ActiveXObject(" Microsoft.XMLHT TP");
oXML.Open("GET" ,sURL,false);
oXML.send();
try {
sTXT = oXML.ResponseTe xt;
} catch(e) {
sTXT = "[" + e.Description + "]";
}
return sTXT;
}

Did you test it in anything other than IE?
The group FAQ covers this very thing.


Which section? Honest, I did check the FAQ. All I found was
section "4.3 -- How can I access the client-side filesystem?"

Eventhough I need to access the server-side, I followed the link to
http://msdn.microsoft.com/library/en...FileSystem.asp
which gives a JScript example of creating/writing on the local drive.

I didn't see anything like McKirahan's example, which also showed
how to use <SPAN>.

I would rather not use ActiveX, since it is often disabled. And
I would really prefer something that worked with more than IE.
But I appreciate any help, I'm a complete newbe.

Thanks

Jul 23 '05 #5
> Which section? Honest, I did check the FAQ. All I found was
section "4.3 -- How can I access the client-side filesystem?"

Eventhough I need to access the server-side, I followed the link to
http://msdn.microsoft.com/library/en...FileSystem.asp which gives a JScript example of creating/writing on the local drive.

I didn't see anything like McKirahan's example, which also showed
how to use <SPAN>.

I would rather not use ActiveX, since it is often disabled. And
I would really prefer something that worked with more than IE.
But I appreciate any help, I'm a complete newbe.

Thanks

http://jibbering.com/2002/4/httprequest.html
Try that. It explains how to use the XMLHttpRequest object, and also
gives an example on how to incorporate the ActiveX (blech) method.

Jul 23 '05 #6
Rose Chambers wrote:
On Wed, 29 Dec 2004 17:52:45 -0500, Randy Webb <Hi************ @aol.com> wrote:
<--snip-->
Did you test it in anything other than IE?
The group FAQ covers this very thing.
Which section? Honest, I did check the FAQ. All I found was
section "4.3 -- How can I access the client-side filesystem?"


4.34 although the wording is elusive.

<FAQENTRY>
Why does 4.34 no longer mention reading files from a server?
</FAQENTRY>
Eventhough I need to access the server-side, I followed the link to
http://msdn.microsoft.com/library/en...FileSystem.asp
which gives a JScript example of creating/writing on the local drive.

I didn't see anything like McKirahan's example, which also showed
how to use <SPAN>.
McKirahan's "solution" also lacked the ability to work in any browser
other than IE. Thats the problem with the example.
I would rather not use ActiveX, since it is often disabled.
So is script, so are you going to forego scripting also?
And I would really prefer something that worked with more than IE.


The HTTPRequest Object works with more than IE. Just not the way the
example was written. The page that the FAQ links to in Sec 4.34 explains
how to use it, and in a cross-browser way.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #7
On Thu, 30 Dec 2004 02:32:08 GMT, Rose Chambers <no@email.com > wrote:
On Wed, 29 Dec 2004 17:52:45 -0500, Randy Webb <Hi************ @aol.com> wrote:
McKirahan wrote:

<--snip-->
function fetch(sURL) {
var sTXT = "";
var oXML = new ActiveXObject(" Microsoft.XMLHT TP");
oXML.Open("GET" ,sURL,false);
oXML.send();
try {
sTXT = oXML.ResponseTe xt;
} catch(e) {
sTXT = "[" + e.Description + "]";
}
return sTXT;
}


<--snip-->

I would rather not use ActiveX, since it is often disabled. And
I would really prefer something that worked with more than IE.

I tested this with IE6, Netscape7.1, FireFox0.9 and Mozilla1.01(lin ux)

<html><head>
<title>swap_tex t.html</title>
<script type="text/javascript">

function display_dataset (dset) {
document.images .swap_grph.src = "/graphs/"+dset+".jp g";
document.getEle mentById("swap_ text").src = "/textfiles/"+dset+".tx t";
}

</script>
</head>
<body onload="display _dataset('data1 ')">

<table>
<tr><td>
<img name="swap_grph " src = "">
</td></tr>
<tr><td>
<iframe id="swap_text" src = "" WIDTH=500 HEIGHT=300></iframe>
</td></tr>
<tr><td>
<form>
<input type="button" value="One" onclick="displa y_dataset('data 1')"/>
<input type="button" value="Two" onclick="displa y_dataset('data 2')"/>
<input type="button" value="Three" onclick="displa y_dataset('data 3')"/>
<input type="button" value="Four" onclick="displa y_dataset('data 4')"/>
<input type="button" value="Five" onclick="displa y_dataset('data 5')"/>
</form>
</td></tr>
</table>

</body></html>

I would give the chart and data table files the same name. Instead of
piechart1.jpg and data_table1.txt , rename them data1.jpg and data1.txt

If this is not possible change the function to accept two parameters, so
you can call it with explicit filenames...
onclick="displa y_dataset('piec hart1.jpg','dat a_table1.txt')"
Jul 23 '05 #8
On Thu, 30 Dec 2004 23:16:31 GMT, Ron Beitel <ro**@not.her e> wrote:

I tested this with IE6, Netscape7.1, FireFox0.9 and Mozilla1.01(lin ux)

<html><head>
<title>swap_te xt.html</title>
<script type="text/javascript">

function display_dataset (dset) {
document.images .swap_grph.src = "/graphs/"+dset+".jp g";
document.getEle mentById("swap_ text").src = "/textfiles/"+dset+".tx t";
}

</script>
</head>
<body onload="display _dataset('data1 ')">

<table>
<tr><td>
<img name="swap_grph " src = "">
</td></tr>
<tr><td>
<iframe id="swap_text" src = "" WIDTH=500 HEIGHT=300></iframe>
</td></tr>
<tr><td>
<form>
<input type="button" value="One" onclick="displa y_dataset('data 1')"/>
<input type="button" value="Two" onclick="displa y_dataset('data 2')"/>
<input type="button" value="Three" onclick="displa y_dataset('data 3')"/>
<input type="button" value="Four" onclick="displa y_dataset('data 4')"/>
<input type="button" value="Five" onclick="displa y_dataset('data 5')"/>
</form>
</td></tr>
</table>

</body></html>

I would give the chart and data table files the same name. Instead of
piechart1.jp g and data_table1.txt , rename them data1.jpg and data1.txt

If this is not possible change the function to accept two parameters, so
you can call it with explicit filenames...
onclick="displa y_dataset('piec hart1.jpg','dat a_table1.txt')"


Problem! Each time a new <iframe> loads, it is a new page. So the brower's
BACK button shows the previous data table, but the graph does not change.

Anyone have any suggestions?

Jul 23 '05 #9

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

Similar topics

2
1890
by: Suchi | last post by:
Hi all: I want to read a textfile from an ASP program. My program is like this: Set fso = CreateObject("Scripting.FileSystemObject") workFile=http://localhost/Readme.txt) Set textFile = FSObj.OpenTextFile(workFile) lines = split(textFile.ReadAll, VBCrLf) textFile.Close
4
3396
by: StumpY | last post by:
Hi I am trying to append information collected from a form into a text file (already created and currently in the root of my web) on my ISP's webserver. The code snippet causing the problem is; ...... 37 <% 38 Dim fso, f, TextFile 39 TextFile = Server.MapPath("mail.txt") 40 Const ForReading = 1, ForWriting = 2, ForAppending = 8 41 Set fso = Server.CreateObject("Scripting.FileSystemObject")
7
12658
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database which is in the "fpdb" folder of my webserver. Its located there so that I can use asp to build a web-based front-end for users to read the database - http://www.nist.ac.th/maths/test1.asp The MBD file is edited using Access (2003) and opening...
6
17174
by: Questman | last post by:
Does anyone have code they could share that would implement a telnet session in a browser using Javascript? I've seen it done once, but they did not have code available. This would be integral to preserving some old telnet-based software but allowing us to move on with web-only code at this point. Thank you in advance to anyone who can assist. (Ideally, it should be cross-browser, of course).
16
4811
by: Roy | last post by:
I use a Access 2K application.I am trying to use Chuck Grimsby(clsReadTextFile.txt)class utility to read a text file and then do a import of the same into my database.The question is how to call these in a button event or any other method. Thanks, Roy
2
2606
by: chris | last post by:
Hi there, I am reading in a textfile which looks like this (there is no new line after the last number) 03 98661881 0407 566453 The code to load the textfile looks like this:
17
1911
by: Denebola | last post by:
I want to be able to play around with some php scripting on my pc without paying a company to host a domain. I have downloaded php onto my pc, at least I think I have, a folder called php has appeared on my C: drive, and I have downloaded and installed the Abyss web server and that appears to be working. I also have HTML Kit as my html editor. How do I get simple php scripts to work properly on my pc though? Where do I save the files?
2
3030
by: novacreatura | last post by:
Hi, I have a project that's supposed to create a program for a "Dating Service". The first part of the program is to read a textfile of profiles which include names, age, etc...into a string array, and be able to add,edit,remove to the textfile of profiles during runtime. What would be the most efficient way to do this to make it easiest as possible to make changes to the textfile during time and access elements of the array?
6
22565
by: =?Utf-8?B?UmljaA==?= | last post by:
'--this code works but only reads text into one column when contains multiple cols Dim ds1x As New DataSet Dim ConStr As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dir1A\;Extended Properties=""Text;HDR=No;FMT=Delimited\""" Dim conn1x As New OleDb.OleDbConnection(ConStr) Dim dax1 As New OleDbDataAdapter("Select * from testabc1x.txt", conn1x)
1
10092
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
9950
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
8974
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
7500
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
6740
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
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.