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:
  #1  
Old March 4th, 2003, 02:53 PM
Nefarious Nefarious is offline
Registered User
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, 08: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: 16
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, 08:34 AM
Nefarious Nefarious is offline
Registered User
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


Developer Shed Advertisers and Affiliates


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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap