473,800 Members | 2,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write to file question

von
I am trying to write a single piece of data (that is generated from a
Javascript) to a text file on my server via a Perl script.

The Javascript is setup so that I can display the required data on my
website using the following HTML:

<span name='Data1' class='data1'></span>

But I need it sent to a text file. :(

I have tried using the following code (thanks to saxifrax) to send the data
to a Perl script:

var i=new Image();
i.src="http://www.mydomain.co m/cgi-bin/write.pl?" + span;

But it doesn't return anything.

If I test my Perl script with this:

var i=new Image();
i.src="http://www.mydomain.co m/cgi-bin/write.pl?" + "test";

Then it returns the word "test" - so I know the Perl script is working.

When I try this:

var i=new Image();
i.src="http://www.mydomain.co m/cgi-bin/write.pl?" + allSpans;

Then it returns "Object" - whatever that means.
Anyone have any advice on how to get the data sent to my Perl file?

Thanks :)

-Von

Jul 23 '05 #1
1 1735
von wrote:
I am trying to write a single piece of data (that is generated from a
Javascript) to a text file on my server via a Perl script.

The Javascript is setup so that I can display the required data on my
website using the following HTML:

<span name='Data1' class='data1'></span>

But I need it sent to a text file. :(

I have tried using the following code (thanks to saxifrax) to send the data to a Perl script:

var i=new Image();
i.src="http://www.mydomain.co m/cgi-bin/write.pl?" + span;

But it doesn't return anything.

If I test my Perl script with this:

var i=new Image();
i.src="http://www.mydomain.co m/cgi-bin/write.pl?" + "test";

Then it returns the word "test" - so I know the Perl script is working.
When I try this:

var i=new Image();
i.src="http://www.mydomain.co m/cgi-bin/write.pl?" + allSpans;

Then it returns "Object" - whatever that means.
Anyone have any advice on how to get the data sent to my Perl file?

Thanks :)

-Von
Not quite clear where that "Object" is coming from...but this is
unclear:
The Javascript is setup so that I can display the required data on my
website using the following HTML:

<span name='Data1' class='data1'></span>


We can't see how the JS is 'setup' - a key factor. Is a text string
being displayed within that span? If so, you can give it an id
(="Data1") - spans don't take names as attributes - and use:

var el, txt;
if (el = document.getEle mentById('Data1 ')
&& (txt = el.firstChild))
{
var i = new Image;
i.src = 'http://www.mydomain.co m/cgi-bin/write.pl?' + txt.nodeValue;
}

Jul 23 '05 #2

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

Similar topics

2
2337
by: lawrence | last post by:
I'm probably missing something obvious, but I'm unable to write a file with this function. I've used my FTP software to set permissions to 777 on all the files in question. I've tried r, r+, w, and w+ as possible ways of opening the files. The first fopen is trying to create a file where none exists. It fails (thought I've set dir permissions to 777 as well). How can I create a file? There error messages print back the full input, so...
3
8596
by: burdeen | last post by:
I can't find any way of writing a unicode, or UTF-8 format text file. Right now i have a Unicode string that i write to the text file and the unicode characters are replaced with ANSI question marks '?'. Please, How do i accomplish this? I've been searching for a solution for weeks... why has nobody even asked this question? shouldn't it be a FAQ?
11
26905
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as follows: private void SubmitButton_Click (object sender, System.EventArgs e) { // Set up the response to write the print file to the client Response.Clear (); Response.AppendHeader ("Content-Disposition", "filename=WebPrint.prn");
5
2031
by: Arvind P Rangan | last post by:
Hi, i like to read an existing xml file which has a schema defined to it, and then write or add data to the existing xml file using vb.net/c#. May be this Question has been answered earlier. Pls if anyone knows the link or example let me know Thanks ARvind.
5
3664
by: philip | last post by:
Here is some lines of code than I wrote. You can copy/paste theis code as code of form1 in a new project. My problem is this one : I try to write in a file a serie of bytes. BUT some bytes written in file are not the sent bytes. Copy and paste the following lines to observe my problem. What can I do to resolve problem ? Only System.Text.Encoding.ASCII write the same number of bytes, but not the good bytes. Someone can help me. Thanks by...
2
3533
by: key9 | last post by:
Hi all look at the organize tree main.c ------ #include lib_adapter.c main() { foo();
14
5237
by: Frank | last post by:
I see that ImageFormat includes exif. But I can't find out if I've System.Drawing.Image.FromStream or something like it can read and/or write that format.
3
5326
by: golden | last post by:
Hello, I am going to ask a question regarding write and lseek. I will provide code at the end of this, but first some background. I am trying to identify the cause of some latency in writing to disk. My user claims that performance is much slower on SAN than on local disk. The developer provided me a C++ program that performed a write
20
5117
by: cscorley | last post by:
For some reason, I cannot use fopen() on the file in write mode. The file "time" is in the same directory as the .php file, with permissions set to 0766. PHP Version 5.2.5 Apache/2.2.8 code snip in question: $file = "time";
3
2047
by: Ben Keshet | last post by:
I have a probably simple beginner's question - I have a script that I am currently able to print its output. instead, i want to write it into a file - I tried different versions of write() but might have gotten the syntax wrong. the variable I want to write is a line from a file I am reading: "... f = open('receptor.mol2', 'r') line = f.readline()
0
9689
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10495
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
10269
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
10248
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,...
1
7573
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
6811
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
5469
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
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
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.