JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old March 4th, 2003, 01:53 PM
Nefarious Nefarious is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fort Lauderdale, FL
Posts: 2 Nefarious User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
saveToTexFile

I am very new to JavaScript and Í'm trying to learn it on my own. I'm currently trying to implement a function that saves a page or table of information to a comma delimited or text delimited textfile but I need help. So far I have the following in one script:

function saveToTextFile() {
var Win3
Win3 = window.open("","SaveWindow","scrollbars,resizable,width=650,height=650");

for (var i=0;i < arrRecs.length; i++) {
Win3.document.writeln(arrRecs[i]+"<br>");
}

Win3.document.writeln('<hr><img src="' + baseURL + 'images/SaveAsInfo.gif"><br>');
Win3.document.writeln('<center><input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value="Save As"><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT></center>');
Win3.document.close();


In a second script I have the following:
<p><font face=Verdana size=1 color="#336699"><b>|<a href="javascriptpener.parent.MapFrame.saveToTextFile() ">Save Results to Text File</a>|</p>

The hyperlink created above is supposed to execute the function by calling another window that has a saveas button. However, I get an error page message when I select my hyperlink.

PLEASE HELP!!!

Reply With Quote
  #2  
Old April 1st, 2003, 07:27 PM
pentapenguin pentapenguin is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 51 pentapenguin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 7 sec
Reputation Power: 6
I don't know how to write to a file in JavaScript (I don't think that it is possible due to security concerns in the browser - would you want somebody you don't know writing to your hard drive? ).
However, it is really easy to do it PHP (or ASP).

Here's a PHP example:



PHP Code:
<?php
//open the process - "w"rite to the file
$filepointer fopen("path/to/file""w");

//write the information
fwrite($filepointer"Text to write");

//close the file
fclose($filepointer);
?>


Check out www.php.net or the articles @ www.devarticles.com

Reply With Quote
  #3  
Old April 3rd, 2003, 07:34 AM
Nefarious Nefarious is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fort Lauderdale, FL
Posts: 2 Nefarious User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi pentapenguin:

I appreciate your response to my inquiry. For clarification purposes, allow me to explain that it was not my intention to allow a browser user to write to my desktop. What I would like to do is have the user write the contents of a frame to THEIR own desktop in a texfile format. Nevertheless, I will investigate the PHP solutions you suggested.

once again, thanks.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > saveToTexFile


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway